summaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2019-08-20 11:28:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-21 18:45:46 +0200
commitde7b9aa633b693e77942e12f1769506efae6917b (patch)
tree0eec1aae5e793fa87f6d905c4adc0b8df0654f74 /drivers/usb/class
parentusb: udc: lpc32xx: silence fall-through warning (diff)
downloadlinux-de7b9aa633b693e77942e12f1769506efae6917b.tar.xz
linux-de7b9aa633b693e77942e12f1769506efae6917b.zip
usbtmc: more sanity checking for packet size
A malicious device can make the driver divide ny zero with a nonsense maximum packet size. Signed-off-by: Oliver Neukum <oneukum@suse.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20190820092826.17694-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/usbtmc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 4942122b2346..36858ddd8d9b 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -2362,8 +2362,11 @@ static int usbtmc_probe(struct usb_interface *intf,
goto err_put;
}
+ retcode = -EINVAL;
data->bulk_in = bulk_in->bEndpointAddress;
data->wMaxPacketSize = usb_endpoint_maxp(bulk_in);
+ if (!data->wMaxPacketSize)
+ goto err_put;
dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in);
data->bulk_out = bulk_out->bEndpointAddress;