]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2020 07:58:43 +0000 (09:58 +0200)
commitb677f601d5e4802e345fdb1d91596fbc1a0c19f5
treef02c7d9ac31b2d4e6b0f463593e72007a8cd2bd5
parent6e66f308d9c71447a2b5a14779ec03b3f0e1a01a
net: lan78xx: add missing endpoint sanity check

[ Upstream commit 8d8e95fd6d69d774013f51e5f2ee10c6e6d1fc14 ]

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: 55d7de9de6c3 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/lan78xx.c