]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan78xx: add missing endpoint sanity check
authorJohan Hovold <johan@kernel.org>
Tue, 28 Jul 2020 12:10:29 +0000 (14:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Jul 2020 20:35:44 +0000 (13:35 -0700)
commite6bf0123df8465ceab5c939f636812342db060d6
tree03ad8c7fe8f15ede76c671a0cfc1b26a4acce2f3
parent9f1d185a81ea7db304c5ade6dcea9b54ca19ee1a
net: lan78xx: add missing endpoint sanity check

Add the missing endpoint sanity check to prevent a NULL-pointer
dereference should a malicious device lack the expected endpoints.

Note that the driver has a broken endpoint-lookup helper,
lan78xx_get_endpoints(), which can end up accepting interfaces in an
altsetting without endpoints as long as *some* altsetting has a bulk-in
and a bulk-out endpoint.

Fixes: f98af78833e9 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Cc: Woojung.Huh@microchip.com <Woojung.Huh@microchip.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/lan78xx.c