usb: interface authorization: Control interface probing and claiming
authorStefan Koch <stefan.koch10@gmail.com>
Tue, 25 Aug 2015 19:10:07 +0000 (21:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Sep 2015 19:08:40 +0000 (12:08 -0700)
Driver probings and interface claims get rejected
if an interface is not authorized.

Signed-off-by: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c

index 6b5063e7943fac720a266478d79b04a352d51e41..047f9f94d72d0d10fd2acbbfd05a2e768fe47cd0 100644 (file)
@@ -296,6 +296,10 @@ static int usb_probe_interface(struct device *dev)
        if (udev->authorized == 0) {
                dev_err(&intf->dev, "Device is not authorized for usage\n");
                return error;
+       } else if (intf->authorized == 0) {
+               dev_err(&intf->dev, "Interface %d is not authorized for usage\n",
+                               intf->altsetting->desc.bInterfaceNumber);
+               return error;
        }
 
        id = usb_match_dynamic_id(intf, driver);
@@ -508,6 +512,10 @@ int usb_driver_claim_interface(struct usb_driver *driver,
        if (dev->driver)
                return -EBUSY;
 
+       /* reject claim if interface is not authorized */
+       if (!iface->authorized)
+               return -ENODEV;
+
        udev = interface_to_usbdev(iface);
 
        dev->driver = &driver->drvwrap.driver;