From: fengchengwen <fengchengwen@huawei.com>
To: Wenjun Wu <wenjun1.wu@intel.com>, <dev@dpdk.org>,
<anatoly.burakov@intel.com>, <qi.z.zhang@intel.com>
Cc: <simei.su@intel.com>, <stable@dpdk.org>
Subject: Re: [PATCH v1 1/2] bus/vdev: fix memory leak
Date: Thu, 6 Jul 2023 08:48:13 +0800 [thread overview]
Message-ID: <34c20eb2-efc9-2a42-72dc-a3abcc608019@huawei.com> (raw)
In-Reply-To: <20230705092511.362484-2-wenjun1.wu@intel.com>
On 2023/7/5 17:25, Wenjun Wu wrote:
> In hotplug usecase, devargs will be allocated in secondary process
> in the function alloc_devargs. Since it will not be insert into the
> devarg_list, it will have no chance to be freed.
>
> This patch adds additional memory free for device structure member devargs
> in the secondary process in rte_vdev_uninit.
>
> Fixes: f5b2eff0847d ("bus/vdev: fix devargs after multi-process bus scan")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
> ---
> drivers/bus/vdev/vdev.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index 7974b27295..3f4e6a1b55 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -373,6 +373,11 @@ rte_vdev_uninit(const char *name)
>
> TAILQ_REMOVE(&vdev_device_list, dev, next);
> rte_devargs_remove(dev->device.devargs);
> + if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
> + dev->device.devargs != NULL) {
The prerequisite is that rte_vdev_init is invoked only in main process.
Suggest more general impl:
ret = rte_devargs_remove(dev->device.devargs);
if (ret != 0) {
rte_devargs_reset(dev->device.devargs);
free(dev->device.devargs);
}
> + rte_devargs_reset(dev->device.devargs);
> + free(dev->device.devargs);
> + }
> free(dev);
>
> unlock:
>
next prev parent reply other threads:[~2023-07-06 0:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230705092511.362484-1-wenjun1.wu@intel.com>
2023-07-05 9:25 ` Wenjun Wu
2023-07-06 0:48 ` fengchengwen [this message]
2023-07-05 9:25 ` [PATCH v1 2/2] examples/multi_process: " Wenjun Wu
2023-07-06 1:02 ` fengchengwen
2023-07-06 5:10 ` Wu, Wenjun1
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=34c20eb2-efc9-2a42-72dc-a3abcc608019@huawei.com \
--to=fengchengwen@huawei.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=simei.su@intel.com \
--cc=stable@dpdk.org \
--cc=wenjun1.wu@intel.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).