From: Maryam Tahhan <mtahhan@redhat.com>
To: Yunjian Wang <wangyunjian@huawei.com>,
Ciara Loftus <ciara.loftus@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
stable@dpdk.org
Subject: Re: [PATCH] net/af_xdp: fix resources leak when xsk configure fails
Date: Thu, 22 Feb 2024 09:54:36 +0000 [thread overview]
Message-ID: <871cc85f-2042-4e1e-a705-1c18fe60ecce@redhat.com> (raw)
In-Reply-To: <1708571262-48380-1-git-send-email-wangyunjian@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
On 22/02/2024 03:07, Yunjian Wang wrote:
> 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;
> }
Does it make sense to: move `xsk_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)
@Yunjian WDYT?
@Ciara WDYT?
[-- Attachment #2: Type: text/html, Size: 2000 bytes --]
next prev parent reply other threads:[~2024-02-22 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 3:07 Yunjian Wang
2024-02-22 9:54 ` Maryam Tahhan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871cc85f-2042-4e1e-a705-1c18fe60ecce@redhat.com \
--to=mtahhan@redhat.com \
--cc=ciara.loftus@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=stable@dpdk.org \
--cc=wangyunjian@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).