]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
USB: usb_driver_claim_interface: add sanity checking
authorOliver Neukum <oneukum@suse.com>
Wed, 16 Mar 2016 12:26:17 +0000 (13:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Mar 2016 16:19:02 +0000 (09:19 -0700)
Attacks that trick drivers into passing a NULL pointer
to usb_driver_claim_interface() using forged descriptors are
known. This thwarts them by sanity checking.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c

index 56593a9a87268cc0f6d8181cb5f8021c252b457b..2057d91d83360ddb614ffaeeb174883c1759f7cf 100644 (file)
@@ -502,11 +502,15 @@ static int usb_unbind_interface(struct device *dev)
 int usb_driver_claim_interface(struct usb_driver *driver,
                                struct usb_interface *iface, void *priv)
 {
-       struct device *dev = &iface->dev;
+       struct device *dev;
        struct usb_device *udev;
        int retval = 0;
        int lpm_disable_error;
 
+       if (!iface)
+               return -ENODEV;
+
+       dev = &iface->dev;
        if (dev->driver)
                return -EBUSY;