From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: gerben@altlinux.org, qemu-devel@nongnu.org, mst@redhat.com
Cc: sdl.qemu@linuxtesting.org
Subject: Re: [PATCH] hw/virtio/virtio-pci: add defensive check for vector_irqfd
Date: Thu, 14 Aug 2025 13:47:50 +0200 [thread overview]
Message-ID: <426f2edc-9495-4796-abd1-b5de6529f015@linaro.org> (raw)
In-Reply-To: <20250814110830.14660-1-gerben@altlinux.org>
Hi Denis,
On 14/8/25 13:08, gerben@altlinux.org wrote:
> From: Denis Rastyogin <gerben@altlinux.org>
>
> Add a NULL check for proxy->vector_irqfd in
> virtio_pci_one_vector_unmask() before taking the irqfd path.
> This prevents potential access to uninitialized state if
> vector_irqfd is absent.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Reported-by: Alexey Appolonov <alexey@altlinux.org>
> Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
> ---
> hw/virtio/virtio-pci.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 767216d795..07904f6f9b 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1015,7 +1015,11 @@ static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
> event_notifier_set(n);
> }
> } else {
> - ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
> + if (proxy->vector_irqfd) {
Why check the callers and not once in the callee?
> + ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
> + } else {
> + ret = -EFAULT;
> + }
> }
> return ret;
> }
next prev parent reply other threads:[~2025-08-14 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 11:08 [PATCH] hw/virtio/virtio-pci: add defensive check for vector_irqfd gerben
2025-08-14 11:47 ` Philippe Mathieu-Daudé [this message]
2025-08-14 13:07 ` Michael S. Tsirkin
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=426f2edc-9495-4796-abd1-b5de6529f015@linaro.org \
--to=philmd@linaro.org \
--cc=gerben@altlinux.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sdl.qemu@linuxtesting.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).