diff options
author | Oliver Neukum <oneukum@suse.com> | 2016-03-16 13:26:17 +0100 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-04-18 08:51:03 -0400 |
commit | febfaffe4aa9b0600028f46f50156e3354e34208 (patch) | |
tree | 08bfc987a0a1c79ba51285fa337d0053150f9645 | |
parent | 14a710bbf6b4095876ff682b3066ac485480049c (diff) |
USB: usb_driver_claim_interface: add sanity checking
[ Upstream commit 0b818e3956fc1ad976bee791eadcbb3b5fec5bfd ]
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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-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 818369afff63..7792c0e2d3b6 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -499,11 +499,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; |