From: "Миронов Сергей Владимирович" <mironov@fintech.ru>
To: "libvirt-security@redhat.com" <libvirt-security@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"libvir-list@redhat.com" <libvir-list@redhat.com>
Cc: "sdl.qemu@linuxtesting.org" <sdl.qemu@linuxtesting.org>
Subject: [sdl-qemu] [PATCH 0/1] There are no checks, virDomainChrSourceDefNew can return 0
Date: Thu, 14 Sep 2023 09:44:13 +0000 [thread overview]
Message-ID: <ace59b33a24b45dbb4075800c0922641@fintech.ru> (raw)
[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]
There are no checks, virDomainChrSourceDefNew can return 0.
Return value of a function 'virDomainChrSourceDefNew'
is dereferenced at qemu_hotplug.c without checking for NULL,
but it is usually checked for this function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1f85f0967b ("ci: jobs.sh: Add back '--no-suite syntax-check --print-errorlogs'")
Signed-off-by: Sergey Mironov <mironov@fintech.ru>
---
src/qemu/qemu_hotplug.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 177ca87d11..09e16c2c7e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3207,6 +3207,8 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver,
qemuAssignDeviceFSAlias(vm->def, fs);
chardev = virDomainChrSourceDefNew(priv->driver->xmlopt);
+ if (chardev == NULL)
+ goto cleanup;
chardev->type = VIR_DOMAIN_CHR_TYPE_UNIX;
chardev->data.nix.path = qemuDomainGetVHostUserFSSocketPath(priv, fs);
--
2.31.1
[-- Attachment #2: Type: text/html, Size: 8802 bytes --]
next reply other threads:[~2023-09-14 12:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 9:44 Миронов Сергей Владимирович [this message]
2023-09-14 10:17 ` [sdl-qemu] [PATCH 0/1] There are no checks, virDomainChrSourceDefNew can return 0 Peter Krempa
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=ace59b33a24b45dbb4075800c0922641@fintech.ru \
--to=mironov@fintech.ru \
--cc=libvir-list@redhat.com \
--cc=libvirt-security@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).