Skip to content

Commit de7b9aa

Browse files
oneukumgregkh
authored andcommitted
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 <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3afa758 commit de7b9aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/class/usbtmc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,8 +2362,11 @@ static int usbtmc_probe(struct usb_interface *intf,
23622362
goto err_put;
23632363
}
23642364

2365+
retcode = -EINVAL;
23652366
data->bulk_in = bulk_in->bEndpointAddress;
23662367
data->wMaxPacketSize = usb_endpoint_maxp(bulk_in);
2368+
if (!data->wMaxPacketSize)
2369+
goto err_put;
23672370
dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in);
23682371

23692372
data->bulk_out = bulk_out->bEndpointAddress;

0 commit comments

Comments
 (0)