Commit bf32b608 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: usb_driver_claim_interface: add sanity checking

commit 0b818e39 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: default avatarOliver Neukum <ONeukum@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c882bf5
...@@ -494,11 +494,15 @@ static int usb_unbind_interface(struct device *dev) ...@@ -494,11 +494,15 @@ static int usb_unbind_interface(struct device *dev)
int usb_driver_claim_interface(struct usb_driver *driver, int usb_driver_claim_interface(struct usb_driver *driver,
struct usb_interface *iface, void *priv) struct usb_interface *iface, void *priv)
{ {
struct device *dev = &iface->dev; struct device *dev;
struct usb_device *udev; struct usb_device *udev;
int retval = 0; int retval = 0;
int lpm_disable_error; int lpm_disable_error;
if (!iface)
return -ENODEV;
dev = &iface->dev;
if (dev->driver) if (dev->driver)
return -EBUSY; return -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment