Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: bcmasp: fix potential memory leak in bcmasp_xmit()
@ 2024-10-14 14:59 Wang Hai
  2024-10-14 17:14 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wang Hai @ 2024-10-14 14:59 UTC (permalink / raw)
  To: justin.chen, florian.fainelli, davem, edumazet, kuba, pabeni,
	horms, zhangxiaoxu5
  Cc: bcm-kernel-feedback-list, netdev, linux-kernel, wanghai38

The bcmasp_xmit() returns NETDEV_TX_OK without freeing skb
in case of mapping fails, add dev_kfree_skb() to fix it.

Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 82768b0e9026..9ea16ef4139d 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -322,6 +322,7 @@ static netdev_tx_t bcmasp_xmit(struct sk_buff *skb, struct net_device *dev)
 			}
 			/* Rewind so we do not have a hole */
 			spb_index = intf->tx_spb_index;
+			dev_kfree_skb(skb);
 			return NETDEV_TX_OK;
 		}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-16  0:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 14:59 [PATCH net] net: bcmasp: fix potential memory leak in bcmasp_xmit() Wang Hai
2024-10-14 17:14 ` Florian Fainelli
2024-10-15 14:52   ` Wang Hai
2024-10-16  0:01   ` Jakub Kicinski
2024-10-16  0:02 ` Florian Fainelli
2024-10-16  0:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox