Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55f3c636 authored by Oliver Neukum's avatar Oliver Neukum Committed by Lee Jones
Browse files

UPSTREAM: sr9700: sanity check for packet length



[ Upstream commit e9da0b56fe27206b49f39805f7dcda8a89379062 ]

A malicious device can leak heap data to user space
providing bogus frame lengths. Introduce a sanity check.

Bug: 225469258
Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
Reviewed-by: default avatarGrant Grundler <grundler@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Change-Id: I2f17bd57b5c4228d0420f716527316a878a34efd
(cherry picked from commit e7f39d0aa294f998ddd55c5becb5e9601912da0d)
parent ea62106b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
		/* ignore the CRC length */
		len = (skb->data[1] | (skb->data[2] << 8)) - 4;

		if (len > ETH_FRAME_LEN)
		if (len > ETH_FRAME_LEN || len > skb->len)
			return 0;

		/* the last packet of current skb */