DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Loftus, Ciara" <ciara.loftus@intel.com>
To: Yunjian Wang <wangyunjian@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>,
	"xudingke@huawei.com" <xudingke@huawei.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v2] net/af_xdp: fix memzone leak in error path
Date: Tue, 5 Dec 2023 13:16:44 +0000	[thread overview]
Message-ID: <MW4PR11MB5872BEDBA9DF55EEA2F2BAF98E85A@MW4PR11MB5872.namprd11.prod.outlook.com> (raw)
In-Reply-To: <ab06b0b804b4b27ea8444381ea14a98a3c3231bb.1701778603.git.wangyunjian@huawei.com>

> 
> In xdp_umem_configure() allocated memzone for the 'umem', we should
> free it when xsk_umem__create() call fails, otherwise it will lead to
> memory zone leak. To fix it move 'umem->mz = mz;' assignment after
> 'mz == NULL' check.
> 
> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> v2: update code suggested by Ferruh Yigit
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
>  1 file changed, 1 insertion(+), 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 353c8688ec..9f0f751d4a 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -1235,6 +1235,7 @@ xsk_umem_info *xdp_umem_configure(struct
> pmd_internals *internals,
>  		goto err;
>  	}
> 
> +	umem->mz = mz;
>  	ret = xsk_umem__create(&umem->umem, mz->addr,
>  			       ETH_AF_XDP_NUM_BUFFERS *
> ETH_AF_XDP_FRAME_SIZE,
>  			       &rxq->fq, &rxq->cq,
> @@ -1244,7 +1245,6 @@ xsk_umem_info *xdp_umem_configure(struct
> pmd_internals *internals,
>  		AF_XDP_LOG(ERR, "Failed to create umem\n");
>  		goto err;
>  	}
> -	umem->mz = mz;
> 
>  	return umem;
> 
> --
> 2.33.0

Thank you for the patch.

Acked-by: Ciara Loftus <ciara.loftus@intel.com>


  reply	other threads:[~2023-12-05 13:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  8:03 [dpdk-dev] [PATCH] " Yunjian Wang
2023-12-04 14:09 ` Ferruh Yigit
2023-12-05  1:23   ` wangyunjian
2023-12-05  9:41     ` Ferruh Yigit
2023-12-05 12:31       ` wangyunjian
2023-12-05 12:23 ` [PATCH v2] " Yunjian Wang
2023-12-05 13:16   ` Loftus, Ciara [this message]
2023-12-06 12:29     ` 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=MW4PR11MB5872BEDBA9DF55EEA2F2BAF98E85A@MW4PR11MB5872.namprd11.prod.outlook.com \
    --to=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=qi.z.zhang@intel.com \
    --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).