summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bcmsysport.c
diff options
context:
space:
mode:
authorWang Hai <wanghai38@huawei.com>2024-10-14 16:51:15 +0200
committerJakub Kicinski <kuba@kernel.org>2024-10-15 21:53:52 +0200
commitc401ed1c709948e57945485088413e1bb5e94bd1 (patch)
tree1a0929f41ba398ea7a4bc5d3c36af6267f819fb1 /drivers/net/ethernet/broadcom/bcmsysport.c
parentnet: ethernet: rtsn: fix potential memory leak in rtsn_start_xmit() (diff)
downloadlinux-c401ed1c709948e57945485088413e1bb5e94bd1.tar.xz
linux-c401ed1c709948e57945485088413e1bb5e94bd1.zip
net: systemport: fix potential memory leak in bcm_sysport_xmit()
The bcm_sysport_xmit() returns NETDEV_TX_OK without freeing skb in case of dma_map_single() fails, add dev_kfree_skb() to fix it. Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver") Signed-off-by: Wang Hai <wanghai38@huawei.com> Link: https://patch.msgid.link/20241014145115.44977-1-wanghai38@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bcmsysport.c')
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c9faa8540859..0a68b526e4a8 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1359,6 +1359,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
netif_err(priv, tx_err, dev, "DMA map failed at %p (len=%d)\n",
skb->data, skb_len);
ret = NETDEV_TX_OK;
+ dev_kfree_skb_any(skb);
goto out;
}