qemuDomainInitializePflashStorageSource() always attaches a non-NULL
src->backingStore used as an empty virStorageSource chain terminator
(type VIR_STORAGE_TYPE_NONE). qemuValidateDomainDefNvram() incorrectly
interpreted every non-NULL backingStore as a genuine backing overlay and
reported VIR_ERR_CONFIG_UNSUPPORTED, so legitimate UEFI/NVRAM setups were
rejected.
Check virStorageSourceIsBacking(src->backingStore) instead of a plain
pointer test so only a real backing node is rejected.

Regression introduced in commit bca731d0f562f0842f56ec2206fdbd721a468f5b.

Signed-off-by: Fima Shevrin <[email protected]>
---
 src/qemu/qemu_validate.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 642244b62e..d8347d1964 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -740,7 +740,14 @@ qemuValidateDomainDefNvram(const virDomainDef *def,
         return -1;
     }

-    if (src->backingStore) {
+    /* qemuDomainInitializePflashStorageSource() always sets
+     * src->backingStore to a fresh empty virStorageSource as a
+     * chain terminator, so a plain `if (src->backingStore)` check
+     * is always true and rejects every UEFI/NVRAM domain after
+     * upstream commit that introduced the terminator. Use
+     * virStorageSourceIsBacking() (type != VIR_STORAGE_TYPE_NONE)
+     * so we only reject genuine backing chains. */
+    if (virStorageSourceIsBacking(src->backingStore)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("backingStore is not supported with NVRAM"));
         return -1;
--
2.47.1

Reply via email to