USB: usb_driver_claim_interface: add sanity checking

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>
This commit is contained in:
Oliver Neukum 2016-03-16 13:26:17 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 7222c83225
Коммит 0b818e3956
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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;