summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2022-02-17 14:10:44 +0100
committerDavid S. Miller <davem@davemloft.net>2022-02-18 12:05:08 +0100
commite9da0b56fe27206b49f39805f7dcda8a89379062 (patch)
treeaa3f9228c114023a5799dd689ba8214023ca0332 /drivers/net
parentnet/sched: act_ct: Fix flow table lookup after ct clear or switching zones (diff)
downloadlinux-e9da0b56fe27206b49f39805f7dcda8a89379062.tar.xz
linux-e9da0b56fe27206b49f39805f7dcda8a89379062.zip
sr9700: sanity check for packet length
A malicious device can leak heap data to user space providing bogus frame lengths. Introduce a sanity check. Signed-off-by: Oliver Neukum <oneukum@suse.com> Reviewed-by: Grant Grundler <grundler@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/sr9700.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index b658510cc9a4..5a53e63d33a6 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -413,7 +413,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 */