Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wang Hai and committed by
Andrew Lunn
2cb3f56e f2767a41

+1
+1
drivers/net/ethernet/i825xx/sun3_82586.c
··· 1012 1012 if(skb->len > XMIT_BUFF_SIZE) 1013 1013 { 1014 1014 printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len); 1015 + dev_kfree_skb(skb); 1015 1016 return NETDEV_TX_OK; 1016 1017 } 1017 1018