DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/af_xdp: fix resources leak when xsk configure fails
@ 2024-02-22  3:07 Yunjian Wang
  2024-02-22  9:54 ` Maryam Tahhan
  2024-02-22 13:35 ` [PATCH v2] " Yunjian Wang
  0 siblings, 2 replies; 9+ messages in thread
From: Yunjian Wang @ 2024-02-22  3:07 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ciara.loftus, xudingke, Yunjian Wang, stable

In xdp_umem_configure() allocated some resources for the
xsk umem, we should delete them when xsk configure fails,
otherwise it will lead to resources leak.

Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 2d151e45c7..8b8b2cff9f 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1723,8 +1723,10 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,
 out_xsk:
 	xsk_socket__delete(rxq->xsk);
 out_umem:
-	if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) - 1 == 0)
+	if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) - 1 == 0) {
+		(void)xsk_umem__delete(rxq->umem->umem);
 		xdp_umem_destroy(rxq->umem);
+	}
 
 	return ret;
 }
-- 
2.41.0


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

end of thread, other threads:[~2024-02-23 11:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22  3:07 [PATCH] net/af_xdp: fix resources leak when xsk configure fails Yunjian Wang
2024-02-22  9:54 ` Maryam Tahhan
2024-02-22 11:05   ` Loftus, Ciara
2024-02-22 11:52     ` wangyunjian
2024-02-22 13:35 ` [PATCH v2] " Yunjian Wang
2024-02-22 15:54   ` Ferruh Yigit
2024-02-22 15:58   ` Loftus, Ciara
2024-02-23  1:45   ` [PATCH v3] " Yunjian Wang
2024-02-23 11:42     ` Ferruh Yigit

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).