@@ -354,6 +354,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
354
354
usbip_dbg_vhci_rh (" ClearHubFeature\n" );
355
355
break ;
356
356
case ClearPortFeature :
357
+ if (rhport < 0 )
358
+ goto error ;
357
359
switch (wValue ) {
358
360
case USB_PORT_FEAT_SUSPEND :
359
361
if (hcd -> speed == HCD_USB3 ) {
@@ -511,11 +513,16 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
511
513
goto error ;
512
514
}
513
515
516
+ if (rhport < 0 )
517
+ goto error ;
518
+
514
519
vhci_hcd -> port_status [rhport ] |= USB_PORT_STAT_SUSPEND ;
515
520
break ;
516
521
case USB_PORT_FEAT_POWER :
517
522
usbip_dbg_vhci_rh (
518
523
" SetPortFeature: USB_PORT_FEAT_POWER\n" );
524
+ if (rhport < 0 )
525
+ goto error ;
519
526
if (hcd -> speed == HCD_USB3 )
520
527
vhci_hcd -> port_status [rhport ] |= USB_SS_PORT_STAT_POWER ;
521
528
else
@@ -524,6 +531,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
524
531
case USB_PORT_FEAT_BH_PORT_RESET :
525
532
usbip_dbg_vhci_rh (
526
533
" SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n" );
534
+ if (rhport < 0 )
535
+ goto error ;
527
536
/* Applicable only for USB3.0 hub */
528
537
if (hcd -> speed != HCD_USB3 ) {
529
538
pr_err ("USB_PORT_FEAT_BH_PORT_RESET req not "
@@ -534,6 +543,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
534
543
case USB_PORT_FEAT_RESET :
535
544
usbip_dbg_vhci_rh (
536
545
" SetPortFeature: USB_PORT_FEAT_RESET\n" );
546
+ if (rhport < 0 )
547
+ goto error ;
537
548
/* if it's already enabled, disable */
538
549
if (hcd -> speed == HCD_USB3 ) {
539
550
vhci_hcd -> port_status [rhport ] = 0 ;
@@ -554,6 +565,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
554
565
default :
555
566
usbip_dbg_vhci_rh (" SetPortFeature: default %d\n" ,
556
567
wValue );
568
+ if (rhport < 0 )
569
+ goto error ;
557
570
if (hcd -> speed == HCD_USB3 ) {
558
571
if ((vhci_hcd -> port_status [rhport ] &
559
572
USB_SS_PORT_STAT_POWER ) != 0 ) {
0 commit comments