[PATCH 0/2] Fix crash when reverting/deleting external inactive snapshots around the root of the snapshot tree
Peter Krempa (2): qemuSnapshotDiskHasBackingDisk: Avoid call of virStorageSourceIsSameLocation with NULL argument qemuSnapshotUpdateBackingStore: Remove stale comment src/qemu/qemu_snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.52.0
From: Peter Krempa <pkrempa@redhat.com> When the 'backingStore' pointer is not populated the function calls 'virStorageSourceGetMetadata' to try to populate it but if the on-disk metadata doesn't have a backing image (e.g. if it's the 'base' image of the chain) the 'backingStore' pointer will still be NULL. The function then calls 'virStorageSourceIsSameLocation' but the internal functions for dealing with storage sources don't handle NULL gracefully. Since for the base image there's nothing to update we need to skip the code if there's no backing store. Closes: https://gitlab.com/libvirt/libvirt/-/issues/844 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_snapshot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index e738afffc3..8f58df3b45 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3147,7 +3147,8 @@ qemuSnapshotDiskHasBackingDisk(void *payload, if (!disk->src->backingStore) ignore_value(virStorageSourceGetMetadata(disk->src, uid, gid, 1, false)); - if (virStorageSourceIsSameLocation(disk->src->backingStore, iterdata->diskSrc)) { + if (disk->src->backingStore && + virStorageSourceIsSameLocation(disk->src->backingStore, iterdata->diskSrc)) { struct _qemuSnapshotDisksWithBackingStoreData *data = g_new0(struct _qemuSnapshotDisksWithBackingStoreData, 1); -- 2.52.0
From: Peter Krempa <pkrempa@redhat.com> The code does a 'qemu-img rebase' rather than a 'qemu-img create' what the commit suggests. Since we enumerate all arguments right below, there's no need for a comment. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_snapshot.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8f58df3b45..19bb6f8b37 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3710,7 +3710,6 @@ qemuSnapshotUpdateBackingStore(qemuSnapshotDeleteExternalData *data) struct _qemuSnapshotDisksWithBackingStoreData *backingData = cur->data; g_autoptr(virCommand) cmd = NULL; - /* creates cmd line args: qemu-img create -f qcow2 -o */ if (!(cmd = virCommandNewArgList("qemu-img", "rebase", "-u", -- 2.52.0
On Fri, Jan 23, 2026 at 08:57:08AM +0100, Peter Krempa via Devel wrote:
Peter Krempa (2): qemuSnapshotDiskHasBackingDisk: Avoid call of virStorageSourceIsSameLocation with NULL argument qemuSnapshotUpdateBackingStore: Remove stale comment
src/qemu/qemu_snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
participants (2)
-
Pavel Hrdina -
Peter Krempa