Skip to content

Commit d8b2283

Browse files
szymonhdavem330
authored andcommitted
net: usb: smsc75xx: Limit packet length to skb->len
Packet length retrieved from skb data may be larger than the actual socket buffer length (up to 9026 bytes). In such case the cloned skb passed up the network stack will leak kernel memory contents. Fixes: d0cad87 ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver") Signed-off-by: Szymon Heidrich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fd6ad75 commit d8b2283

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/smsc75xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
22122212
dev->net->stats.rx_frame_errors++;
22132213
} else {
22142214
/* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */
2215-
if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) {
2215+
if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12) ||
2216+
size > skb->len)) {
22162217
netif_dbg(dev, rx_err, dev->net,
22172218
"size err rx_cmd_a=0x%08x\n",
22182219
rx_cmd_a);

0 commit comments

Comments
 (0)