From: Peter Krempa <pkre...@redhat.com>

'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 <pkre...@redhat.com>
---
 src/qemu/qemu_block.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 27ef1b8375..f0601924ae 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -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]);
 }
-- 
2.49.0

Reply via email to