<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 22/02/2024 03:07, Yunjian Wang
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1708571262-48380-1-git-send-email-wangyunjian@huawei.com">
<pre class="moz-quote-pre" wrap="">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: <a class="moz-txt-link-abbreviated" href="mailto:stable@dpdk.org">stable@dpdk.org</a>
Signed-off-by: Yunjian Wang <a class="moz-txt-link-rfc2396E" href="mailto:wangyunjian@huawei.com"><wangyunjian@huawei.com></a>
---
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;
}
</pre>
</blockquote>
<pre>
D<span style="white-space: pre-wrap">oes it make sense to: move `x</span>sk_umem__delete()` inside `xdp_umem_destroy()` to be invoked after a NULL check for `umem->umem`
and then fixup the places where both functions are called to only invoke `xdp_umem_destroy()`? (Keeping all the umem cleanup code
in one place)</pre>
<pre class="moz-quote-pre" wrap="">@Yunjian WDYT?
@Ciara WDYT?
</pre>
<p></p>
</body>
</html>