Skip to content

Commit

Permalink
sr9700: sanity check for packet length
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and David S. Miller committed Feb 18, 2022
1 parent 2f131de commit e9da0b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/usb/sr9700.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e9da0b5

Please sign in to comment.