diff options
author | Szymon Heidrich <szymon.heidrich@gmail.com> | 2023-03-13 23:00:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-03-15 08:52:53 +0000 |
commit | d8b228318935044dafe3a5bc07ee71a1f1424b8d (patch) | |
tree | c705010af6c28753981e5db7a8598b3625a0f309 /drivers/net/usb | |
parent | fd6ad75f8c008925e279576dc749ad12aa3fb64b (diff) | |
download | linux-stable-d8b228318935044dafe3a5bc07ee71a1f1424b8d.tar.gz linux-stable-d8b228318935044dafe3a5bc07ee71a1f1424b8d.tar.bz2 linux-stable-d8b228318935044dafe3a5bc07ee71a1f1424b8d.zip |
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: d0cad871703b ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/smsc75xx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 95de452ff4da..db34f8d1d605 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -2212,7 +2212,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) dev->net->stats.rx_frame_errors++; } else { /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */ - if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) { + if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12) || + size > skb->len)) { netif_dbg(dev, rx_err, dev->net, "size err rx_cmd_a=0x%08x\n", rx_cmd_a); |