usbnet: ignore endpoints with invalid wMaxPacketSize
authorBjørn Mork <bjorn@mork.no>
Wed, 18 Sep 2019 12:17:38 +0000 (14:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 10:47:42 +0000 (12:47 +0200)
commit6c95f6a3c9c313d46fbf7f466671e2523b0b171c
tree1e7062ad93baec41f846b5f5582fd1082456c090
parent18630dae061c05af8220bd4b64e8214b60a06f58
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>
drivers/net/usb/usbnet.c