Skip to content

There are no checks, virDomainChrSourceDefNew can return 0

Миронов Сергей Владимирович qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 1 replyIn review

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [sdl-qemu] [PATCH 0/1] There are no checks, virDomainChrSourceDefNew can return 0

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'")

---
src/qemu/qemu_hotplug.c | 2 ++

 1 file changed, 2 insertions(+)
src/qemu/qemu_hotplug.c +2 -1
index 177ca87d11..09e16c2c7e 100644
@@ -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