]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
usbip: vhci_hcd fix shift out-of-bounds in vhci_hub_control()
authorShuah Khan <skhan@linuxfoundation.org>
Wed, 24 Mar 2021 23:06:54 +0000 (17:06 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 23 Apr 2021 09:58:37 +0000 (11:58 +0200)
BugLink: https://bugs.launchpad.net/bugs/1923869
commit 1cc5ed25bdade86de2650a82b2730108a76de20c upstream.

Fix shift out-of-bounds in vhci_hub_control() SetPortFeature handling.

UBSAN: shift-out-of-bounds in drivers/usb/usbip/vhci_hcd.c:605:42
shift exponent 768 is too large for 32-bit type 'int'

Reported-by: syzbot+3dea30b047f41084de66@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210324230654.34798-1-skhan@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/usb/usbip/vhci_hcd.c

index fee511437abe371905606a18525505adab1b7faf..1e0b618e2e6ec75a84c5341549bcce16f75b5e0c 100644 (file)
@@ -595,6 +595,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                pr_err("invalid port number %d\n", wIndex);
                                goto error;
                        }
+                       if (wValue >= 32)
+                               goto error;
                        if (hcd->speed == HCD_USB3) {
                                if ((vhci_hcd->port_status[rhport] &
                                     USB_SS_PORT_STAT_POWER) != 0) {