Skip to content

Commit

Permalink
USB: usb_driver_claim_interface: add sanity checking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Mar 18, 2016
1 parent 7222c83 commit 0b818e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 0b818e3

Please sign in to comment.