usb: aqc111: check packet for fixup for true limit
authorOliver Neukum <oneukum@suse.com>
Wed, 15 Nov 2023 10:08:57 +0000 (11:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:01:55 +0000 (17:01 +0100)
commit2ebf775f0541ae0d474836fa0cf3220e502f8e3e
tree1940e4d2c9f6ab365ddaa751bc00c9cfdf0446b5
parent54d8c1d3261dfb8be84ffc17cf94fa231c9d88d4
usb: aqc111: check packet for fixup for true limit

[ Upstream commit ccab434e674ca95d483788b1895a70c21b7f016a ]

If a device sends a packet that is inbetween 0
and sizeof(u64) the value passed to skb_trim()
as length will wrap around ending up as some very
large value.

The driver will then proceed to parse the header
located at that position, which will either oops or
process some random value.

The fix is to check against sizeof(u64) rather than
0, which the driver currently does. The issue exists
since the introduction of the driver.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/aqc111.c