mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
net: ethernet: aeroflex: fix potential memory leak in greth_start_xmit_gbit()
The greth_start_xmit_gbit() returns NETDEV_TX_OK without freeing skb
in case of skb->len being too long, add dev_kfree_skb() to fix it.
Fixes: d4c41139df
("net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Link: https://patch.msgid.link/20241012110434.49265-1-wanghai38@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a1494d532e
commit
cf57b5d7a2
@ -484,7 +484,7 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
if (unlikely(skb->len > MAX_FRAME_SIZE)) {
|
||||
dev->stats.tx_errors++;
|
||||
goto out;
|
||||
goto len_error;
|
||||
}
|
||||
|
||||
/* Save skb pointer. */
|
||||
@ -575,6 +575,7 @@ frag_map_error:
|
||||
map_error:
|
||||
if (net_ratelimit())
|
||||
dev_warn(greth->dev, "Could not create TX DMA mapping\n");
|
||||
len_error:
|
||||
dev_kfree_skb(skb);
|
||||
out:
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user