From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Cc: stable@dpdk.org, Chenbo Xia <chenbo.xia@intel.com>,
Yuanhan Liu <yliu@fridaylinux.org>,
Wenfeng Liu <liuwf@arraynetworks.com.cn>,
Jianfeng Tan <jianfeng.tan@intel.com>
Subject: Re: [PATCH] net/virtio-user: fix leak when initialisation fails
Date: Mon, 17 Apr 2023 08:43:43 +0200 [thread overview]
Message-ID: <c5396873-d4d6-7e4e-dce9-2d3dc286f1c4@redhat.com> (raw)
In-Reply-To: <20230413101041.1638478-1-david.marchand@redhat.com>
On 4/13/23 12:10, David Marchand wrote:
> Caught with ASan.
> If initialising a virtio_user port fails, we may leak the ifname passed
> via a devargs.
>
> Fixes: 4214a1b493f2 ("net/virtio-user: support changing tap interface name")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index f46a131b5c..744f3c30d2 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -696,11 +696,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
> dev->frontend_features = 0;
> dev->unsupported_features = 0;
> dev->backend_type = backend_type;
> -
> - if (*ifname) {
> - dev->ifname = *ifname;
> - *ifname = NULL;
> - }
> + dev->ifname = *ifname;
>
> if (virtio_user_dev_setup(dev) < 0) {
> PMD_INIT_LOG(ERR, "(%s) backend set up fails", dev->path);
> @@ -794,6 +790,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
> }
> }
>
> + *ifname = NULL;
> return 0;
>
> notify_uninit:
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
next prev parent reply other threads:[~2023-04-17 6:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 10:10 David Marchand
2023-04-17 6:43 ` Maxime Coquelin [this message]
2023-04-18 18:15 ` Tyler Retzlaff
2023-06-01 20:00 ` Maxime Coquelin
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=c5396873-d4d6-7e4e-dce9-2d3dc286f1c4@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=liuwf@arraynetworks.com.cn \
--cc=stable@dpdk.org \
--cc=yliu@fridaylinux.org \
/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).