Skip to content
Snippets Groups Projects
Commit e9da0b56 authored by Oliver Neukum's avatar Oliver Neukum Committed by David S. Miller
Browse files

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: default avatarOliver Neukum <oneukum@suse.com>
Reviewed-by: default avatarGrant Grundler <grundler@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2f131de3
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment