]> git.baikalelectronics.ru Git - kernel.git/commit
net: usb: sr9700: Handle negative len
authorSzymon Heidrich <szymon.heidrich@gmail.com>
Sat, 14 Jan 2023 18:23:26 +0000 (19:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:38 +0000 (07:52 +0100)
commit73da3a86719d92f2d7b755816819016bb9a61027
tree619463fa257cda2d31d36f97353f301c557180ea
parenta6bd9ccf5e5a26a4fdf5e4e91bba18305281b27e
net: usb: sr9700: Handle negative len

[ Upstream commit ecf7cf8efb59789e2b21d2f9ab926142579092b2 ]

Packet len computed as difference of length word extracted from
skb data and four may result in a negative value. In such case
processing of the buffer should be interrupted rather than
setting sr_skb->len to an unexpectedly large value (due to cast
from signed to unsigned integer) and passing sr_skb to
usbnet_skb_return.

Fixes: 250634397fa9 ("sr9700: sanity check for packet length")
Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Link: https://lore.kernel.org/r/20230114182326.30479-1-szymon.heidrich@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/sr9700.c