Skip to content

Commit 8d3d7c2

Browse files
bmorkJakub Kicinski
authored andcommitted
usbnet: ignore endpoints with invalid wMaxPacketSize
Endpoints with zero wMaxPacketSize are not usable for transferring data. Ignore such endpoints when looking for valid in, out and status pipes, to make the drivers more robust against invalid and meaningless descriptors. The wMaxPacketSize of these endpoints are used for memory allocations and as divisors in many usbnet minidrivers. Avoiding zero is therefore critical. Signed-off-by: Bjørn Mork <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3fe4b33 commit 8d3d7c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/usb/usbnet.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
100100
int intr = 0;
101101

102102
e = alt->endpoint + ep;
103+
104+
/* ignore endpoints which cannot transfer data */
105+
if (!usb_endpoint_maxp(&e->desc))
106+
continue;
107+
103108
switch (e->desc.bmAttributes) {
104109
case USB_ENDPOINT_XFER_INT:
105110
if (!usb_endpoint_dir_in(&e->desc))

0 commit comments

Comments
 (0)