DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Yunjian Wang <wangyunjian@huawei.com>, dev@dpdk.org
Cc: ciara.loftus@intel.com, xudingke@huawei.com, stable@dpdk.org
Subject: Re: [PATCH v2] net/af_xdp: fix resources leak when xsk configure fails
Date: Thu, 22 Feb 2024 15:54:04 +0000	[thread overview]
Message-ID: <8209b3f9-92a0-4bf4-bab3-b9e7920583d7@amd.com> (raw)
In-Reply-To: <1708608939-14440-1-git-send-email-wangyunjian@huawei.com>

On 2/22/2024 1:35 PM, 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>
> ---
> v2: update code style as suggested by Maryam Tahhan
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 2d151e45c7..b52513bd7e 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -960,6 +960,11 @@ remove_xdp_program(struct pmd_internals *internals)
>  static void
>  xdp_umem_destroy(struct xsk_umem_info *umem)
>  {
> +	if (umem->umem) {
> +		(void)xsk_umem__delete(umem->umem);
> +		umem->umem = NULL;
> +	}
> +
>

NULL check can be eliminted, 'xsk_umem__delete()' already doing it


  reply	other threads:[~2024-02-22 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  3:07 [PATCH] " 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 [this message]
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=8209b3f9-92a0-4bf4-bab3-b9e7920583d7@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@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).