From: "Cédric Le Goater" <clg@redhat.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>, qemu-devel@nongnu.org
Cc: minwoo.im@samsung.com, alex.williamson@redhat.com, chao.p.peng@intel.com
Subject: Re: [PATCH] vfio/pci: Fix a use-after-free issue
Date: Tue, 16 May 2023 10:57:43 +0200 [thread overview]
Message-ID: <a704c7bf-3e04-e919-03e2-149f82c04a2b@redhat.com> (raw)
In-Reply-To: <20230516034357.61276-1-zhenzhong.duan@intel.com>
On 5/16/23 05:43, Zhenzhong Duan wrote:
> We should free the duplicated variant of vbasedev->name plus uuid
> rather than vbasedev->name itself.
>
> Fixes: 2dca1b37a7 ("vfio/pci: add support for VF toke")
"toke" -> "token"
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
> hw/vfio/pci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index bf27a3990564..d2593681e000 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2998,7 +2998,9 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
> }
>
> ret = vfio_get_device(group, name, vbasedev, errp);
> - g_free(name);
> + if (name != vbasedev->name) {
yes. I wonder if we shouldn't use the same test with which 'name' was
allocated instead :
if (!qemu_uuid_is_null(&vdev->vf_token)) {
Thanks,
C.
> + g_free(name);
> + }
> if (ret) {
> vfio_put_group(group);
> goto error;
next prev parent reply other threads:[~2023-05-16 8:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 3:43 [PATCH] vfio/pci: Fix a use-after-free issue Zhenzhong Duan
2023-05-16 8:57 ` Cédric Le Goater [this message]
2023-05-16 10:02 ` Duan, Zhenzhong
2023-05-16 18:59 ` Alex Williamson
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=a704c7bf-3e04-e919-03e2-149f82c04a2b@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=minwoo.im@samsung.com \
--cc=qemu-devel@nongnu.org \
--cc=zhenzhong.duan@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).