* [PATCH net] nfp: xsk: fix memory leak in nfp_net_alloc()
@ 2025-10-24 15:25 Abdun Nihaal
2025-10-28 1:18 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2025-10-24 15:25 UTC (permalink / raw)
To: kuba
Cc: Abdun Nihaal, horms, andrew+netdev, davem, edumazet, pabeni, tglx,
louis.peens, mingo, mheib, easwar.hariharan, sdf, kees,
niklas.soderlund, oss-drivers, netdev, linux-kernel
In nfp_net_alloc(), the memory allocated for xsk_pools is not freed in
the subsequent error paths, leading to a memory leak. Fix that by
freeing it in the error path.
Fixes: 6402528b7a0b ("nfp: xsk: add AF_XDP zero-copy Rx and Tx support")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 132626a3f9f7..f59466877be2 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2566,6 +2566,7 @@ nfp_net_alloc(struct pci_dev *pdev, const struct nfp_dev_info *dev_info,
return nn;
err_free_nn:
+ kfree(nn->dp.xsk_pools);
if (nn->dp.netdev)
free_netdev(nn->dp.netdev);
else
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] nfp: xsk: fix memory leak in nfp_net_alloc()
2025-10-24 15:25 [PATCH net] nfp: xsk: fix memory leak in nfp_net_alloc() Abdun Nihaal
@ 2025-10-28 1:18 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-10-28 1:18 UTC (permalink / raw)
To: Abdun Nihaal
Cc: horms, andrew+netdev, davem, edumazet, pabeni, tglx, louis.peens,
mingo, mheib, easwar.hariharan, sdf, kees, niklas.soderlund,
oss-drivers, netdev, linux-kernel
On Fri, 24 Oct 2025 20:55:22 +0530 Abdun Nihaal wrote:
> err_free_nn:
> + kfree(nn->dp.xsk_pools);
> if (nn->dp.netdev)
> free_netdev(nn->dp.netdev);
Please add dedicated jump label for places which need to free xsk_pools
--
pw-bot: cr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-28 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 15:25 [PATCH net] nfp: xsk: fix memory leak in nfp_net_alloc() Abdun Nihaal
2025-10-28 1:18 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).