All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sfc: fix potential memleak in __ef100_hard_start_xmit()
@ 2022-11-17  7:50 Zhang Changzhong
  2022-11-17 11:36 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Zhang Changzhong @ 2022-11-17  7:50 UTC (permalink / raw)
  To: Edward Cree, Martin Habets, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Zhang Changzhong, netdev, linux-kernel

The __ef100_hard_start_xmit() returns NETDEV_TX_OK without freeing skb
in error handling case, add dev_kfree_skb_any() to fix it.

Fixes: 51b35a454efd ("sfc: skeleton EF100 PF driver")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/ethernet/sfc/ef100_netdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
index 88fa295..ddcc325 100644
--- a/drivers/net/ethernet/sfc/ef100_netdev.c
+++ b/drivers/net/ethernet/sfc/ef100_netdev.c
@@ -218,6 +218,7 @@ netdev_tx_t __ef100_hard_start_xmit(struct sk_buff *skb,
 		   skb->len, skb->data_len, channel->channel);
 	if (!efx->n_channels || !efx->n_tx_channels || !channel) {
 		netif_stop_queue(net_dev);
+		dev_kfree_skb_any(skb);
 		goto err;
 	}
 
-- 
2.9.5


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

end of thread, other threads:[~2022-11-22 10:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  7:50 [PATCH net] sfc: fix potential memleak in __ef100_hard_start_xmit() Zhang Changzhong
2022-11-17 11:36 ` Leon Romanovsky
2022-11-17 12:41   ` Zhang Changzhong
2022-11-17 13:05     ` Leon Romanovsky
2022-11-18  9:15       ` Martin Habets
2022-11-18 11:53         ` Zhang Changzhong
2022-11-18 17:11         ` Leon Romanovsky
2022-11-22  8:28           ` Paolo Abeni
2022-11-22  9:47             ` Leon Romanovsky
2022-11-18  9:13 ` Martin Habets
2022-11-22 10:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.