]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: block: Don't crash if qemuBlockThrottleFiltersDetach gets NULL @data
authorPeter Krempa <pkrempa@redhat.com>
Fri, 11 Apr 2025 11:39:06 +0000 (13:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 11 Apr 2025 14:24:59 +0000 (16:24 +0200)
'qemuBlockThrottleFiltersDetach' crashes if @data is NULL. That can
happen in 'qemuDomainAttachDiskGeneric' as it's used as a rollback path
in cases when we didn't yet initialize the filter struct.

Fix it by tolerating NULL @data.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/765
Fixes: 9a6560f066d1e65502d901f32ff2e91ffed3b209
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_block.c

index 27ef1b8375f484992fb22293699bade4ce0a3d9e..f0601924ae1dde8ef6a8a77957a21e76614da757 100644 (file)
@@ -2875,6 +2875,9 @@ qemuBlockThrottleFiltersDetach(qemuMonitor *mon,
 {
     size_t i;
 
+    if (!data)
+        return;
+
     for (i = data->nfilterdata; i > 0; i--)
         qemuBlockThrottleFilterAttachRollback(mon, data->filterdata[i-1]);
 }