diff options
author | Oliver Neukum <oneukum@suse.com> | 2016-03-16 13:26:17 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-12 09:08:41 -0700 |
commit | b6c6426252e2653407811f46c883661955b9f5fa (patch) | |
tree | f78a9253351c4986e5c998c9406cd1ea1071c5e5 /drivers/usb/core | |
parent | 850631bedd3cb7f79cb32a456c9ad3a5f6e1d1f3 (diff) | |
download | lwn-b6c6426252e2653407811f46c883661955b9f5fa.tar.gz lwn-b6c6426252e2653407811f46c883661955b9f5fa.zip |
USB: usb_driver_claim_interface: add sanity checking
commit 0b818e3956fc1ad976bee791eadcbb3b5fec5bfd upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/driver.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 56593a9a8726..2057d91d8336 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -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; |