patch "usbip: vhci_hcd: check rhport before using in vhci_hub_control()" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usbip: vhci_hcd: check rhport before using in vhci_hub_control()
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
5b22f676118ff25049382041da0db8012e57c9e8Mon Sep 17 00:00:00 2001
From: Shuah Khan <[email protected]>
Date: Thu, 5 Apr 2018 16:31:49 -0600
Subject: usbip: vhci_hcd: check rhport before using in vhci_hub_control()
Validate !rhport < 0 before using it to access port_status array.
--- drivers/usb/usbip/vhci_hcd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/usbip/vhci_hcd.c +13 -0
@@ -354,6 +354,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,usbip_dbg_vhci_rh (" ClearHubFeature\n" );break ;case ClearPortFeature: +if (rhport <0 ) + goto error;switch (wValue) {case USB_PORT_FEAT_SUSPEND :if (hcd->speed ==HCD_USB3 ) {
@@ -511,11 +513,16 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, goto error; } +if (rhport <0 ) + goto error; + vhci_hcd->port_status[rhport] |=USB_PORT_STAT_SUSPEND ;break ;case USB_PORT_FEAT_POWER :usbip_dbg_vhci_rh (" SetPortFeature: USB_PORT_FEAT_POWER\n" ); +if (rhport <0 ) + goto error;if (hcd->speed ==HCD_USB3 ) vhci_hcd->port_status[rhport] |=USB_SS_PORT_STAT_POWER ;else
@@ -524,6 +531,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,case USB_PORT_FEAT_BH_PORT_RESET :usbip_dbg_vhci_rh (" SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n" ); +if (rhport <0 ) + goto error;/* Applicable only for USB3.0 hub */ if (hcd->speed !=HCD_USB3 ) { 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,case USB_PORT_FEAT_RESET :usbip_dbg_vhci_rh (" SetPortFeature: USB_PORT_FEAT_RESET\n" ); +if (rhport <0 ) + goto error;/* if it's already enabled, disable */ if (hcd->speed ==HCD_USB3 ) { vhci_hcd->port_status[rhport] =0 ;
@@ -554,6 +565,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,default :usbip_dbg_vhci_rh (" SetPortFeature: default %d\n" , wValue); +if (rhport <0 ) + goto error;if (hcd->speed ==HCD_USB3 ) {if ((vhci_hcd->port_status[rhport] &USB_SS_PORT_STAT_POWER ) !=0 ) {
Signature · 1 line
2.17.0