aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/usbnet.c
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2019-09-18 08:17:38 -0400
committerJakub Kicinski <jakub.kicinski@netronome.com>2019-09-21 15:06:55 -0400
commit8d3d7c2029c1b360f1a6b0a2fca470b57eb575c0 (patch)
tree960260760a86a6189cf73fc2c9bee21a44af7e0a /drivers/net/usb/usbnet.c
parent3fe4b3351301660653a2bc73f2226da0ebd2b95e (diff)
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 <bjorn@mork.no> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'drivers/net/usb/usbnet.c')
-rw-r--r--drivers/net/usb/usbnet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e44849499b89..dde05e2fdc3e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -100,6 +100,11 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
100 int intr = 0; 100 int intr = 0;
101 101
102 e = alt->endpoint + ep; 102 e = alt->endpoint + ep;
103
104 /* ignore endpoints which cannot transfer data */
105 if (!usb_endpoint_maxp(&e->desc))
106 continue;
107
103 switch (e->desc.bmAttributes) { 108 switch (e->desc.bmAttributes) {
104 case USB_ENDPOINT_XFER_INT: 109 case USB_ENDPOINT_XFER_INT:
105 if (!usb_endpoint_dir_in(&e->desc)) 110 if (!usb_endpoint_dir_in(&e->desc))