]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix lookup against stateless/combined pflash
authorAndrea Bolognani <abologna@redhat.com>
Fri, 26 May 2023 15:47:42 +0000 (17:47 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 21 Aug 2023 11:51:20 +0000 (13:51 +0200)
Just like the more common split builds, these are of type
QEMU_FIRMWARE_DEVICE_FLASH; however, they have no associated
NVRAM template, so we can't access the corresponding structure
member unconditionally or we'll trigger a crash.

https://bugzilla.redhat.com/show_bug.cgi?id=2196178

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_firmware.c

index 5f030ebce4a9b30ea1c607ac889b4460b59cfe3c..b1d342563b488d6a49b404b7b9f9cf4d09a2776e 100644 (file)
@@ -971,9 +971,12 @@ qemuFirmwareMatchesPaths(const qemuFirmware *fw,
         if (loader && loader->path &&
             STRNEQ(loader->path, flash->executable.filename))
             return false;
-        if (loader && loader->nvramTemplate &&
-            STRNEQ(loader->nvramTemplate, flash->nvram_template.filename))
-            return false;
+        if (loader && loader->nvramTemplate) {
+            if (flash->mode != QEMU_FIRMWARE_FLASH_MODE_SPLIT)
+                return false;
+            if (STRNEQ(loader->nvramTemplate, flash->nvram_template.filename))
+                return false;
+        }
         break;
     case QEMU_FIRMWARE_DEVICE_MEMORY:
         if (loader && loader->path &&