summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2019-09-18 14:17:38 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 12:27:42 +0200
commit608557096364a7307467e3f5b005630dd2835f3e (patch)
tree018ac1c4ac1b438ee303026b8706aadb12adb7c9
parent2a7604cde62bdebaec8cc2e487349ed47dabb8a0 (diff)
downloadlinux-stable-608557096364a7307467e3f5b005630dd2835f3e.tar.gz
linux-stable-608557096364a7307467e3f5b005630dd2835f3e.tar.bz2
linux-stable-608557096364a7307467e3f5b005630dd2835f3e.zip
usbnet: ignore endpoints with invalid wMaxPacketSize
[ Upstream commit 8d3d7c2029c1b360f1a6b0a2fca470b57eb575c0 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 2502681369cd..6c531abe198b 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -115,6 +115,11 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
int intr = 0;
e = alt->endpoint + ep;
+
+ /* ignore endpoints which cannot transfer data */
+ if (!usb_endpoint_maxp(&e->desc))
+ continue;
+
switch (e->desc.bmAttributes) {
case USB_ENDPOINT_XFER_INT:
if (!usb_endpoint_dir_in(&e->desc))