mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
usbnet: ignore endpoints with invalid wMaxPacketSize
[ Upstream commit 8d3d7c2029 ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ff4419d725
commit
b7eeccc1c7
@@ -112,6 +112,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))
|
||||
|
||||
Reference in New Issue
Block a user