From: Bjørn Mork Date: Wed, 18 Sep 2019 12:17:38 +0000 (+0200) Subject: usbnet: ignore endpoints with invalid wMaxPacketSize X-Git-Tag: microblaze-v5.5-rc1~43^2~72 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=8d3d7c2029c1b360f1a6b0a2fca470b57eb575c0;p=linux-2.6-microblaze.git 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 Signed-off-by: Jakub Kicinski --- 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) 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))