sr9700: sanity check for packet length
Subsystems (4)
PATCH 1/1 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 <[email protected]>
--- drivers/net/usb/sr9700.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/sr9700.c +1 -1
@@ -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 */
Signature · 1 line
2.34.1
Quoted 5 lines · Oliver Neukum
A malicious device can leak heap data to user space providing bogus frame lengths. Introduce a sanity check.
Signed-off-by Oliver Neukum <[email protected]>
Reviewed-by Grant Grundler <[email protected]>
Quoted 9 lines
--- drivers/net/usb/sr9700.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/usb/sr9700.c +0
-0
drivers/net/usb/sr9700.c static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · line 416
Quoted 5 lines
drivers/net/usb/sr9700.c +1
-1@@ -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)
good catch.
Quoted 6 lines
drivers/net/usb/sr9700.c +0
-1return 0 ;/* the last packet of current skb */ --2.34.1
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 7 lines · On Thu, 17 Feb 2022 14:10:44 +0100 you wrote:
A malicious device can leak heap data to user space providing bogus frame lengths. Introduce a sanity check.
Signed-off-by Oliver Neukum <[email protected]>--- drivers/net/usb/sr9700.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- sr9700: sanity check for packet length
https://git.kernel.org/netdev/net/c/e9da0b56fe27
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html