mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
nfp: xsk: fix memory leak in nfp_net_alloc()
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: 6402528b7a ("nfp: xsk: add AF_XDP zero-copy Rx and Tx support")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Link: https://patch.msgid.link/20251028160845.126919-1-nihaal@cse.iitm.ac.in
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
bcc843bb0e
commit
a4384d786e
@@ -2557,14 +2557,16 @@ nfp_net_alloc(struct pci_dev *pdev, const struct nfp_dev_info *dev_info,
|
||||
err = nfp_net_tlv_caps_parse(&nn->pdev->dev, nn->dp.ctrl_bar,
|
||||
&nn->tlv_caps);
|
||||
if (err)
|
||||
goto err_free_nn;
|
||||
goto err_free_xsk_pools;
|
||||
|
||||
err = nfp_ccm_mbox_alloc(nn);
|
||||
if (err)
|
||||
goto err_free_nn;
|
||||
goto err_free_xsk_pools;
|
||||
|
||||
return nn;
|
||||
|
||||
err_free_xsk_pools:
|
||||
kfree(nn->dp.xsk_pools);
|
||||
err_free_nn:
|
||||
if (nn->dp.netdev)
|
||||
free_netdev(nn->dp.netdev);
|
||||
|
||||
Reference in New Issue
Block a user