summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorWang Hai <wanghai38@huawei.com>2024-10-15 16:41:48 +0200
committerAndrew Lunn <andrew@lunn.ch>2024-10-19 23:04:20 +0200
commit2cb3f56e827abb22c4168ad0c1bbbf401bb2f3b8 (patch)
treea23601d9f573c9d338b114992b21347a6605c665 /drivers/net/ethernet
parentnet: pse-pd: Fix out of bound for loop (diff)
downloadlinux-2cb3f56e827abb22c4168ad0c1bbbf401bb2f3b8.tar.xz
linux-2cb3f56e827abb22c4168ad0c1bbbf401bb2f3b8.zip
net/sun3_82586: fix potential memory leak in sun3_82586_send_packet()
The sun3_82586_send_packet() returns NETDEV_TX_OK without freeing skb in case of skb->len being too long, add dev_kfree_skb() to fix it. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Wang Hai <wanghai38@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> Message-ID: <20241015144148.7918-1-wanghai38@huawei.com> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/i825xx/sun3_82586.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/i825xx/sun3_82586.c b/drivers/net/ethernet/i825xx/sun3_82586.c
index f2d4669c81cf..58a3d28d938c 100644
--- a/drivers/net/ethernet/i825xx/sun3_82586.c
+++ b/drivers/net/ethernet/i825xx/sun3_82586.c
@@ -1012,6 +1012,7 @@ sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
if(skb->len > XMIT_BUFF_SIZE)
{
printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len);
+ dev_kfree_skb(skb);
return NETDEV_TX_OK;
}