On Fri, Aug 16, 2024 at 04:42:32PM +0200, Peter Krempa wrote:
Some code paths, such as if hotplug of an empty cdrom fails can cause
that 'qemuBlockStorageSourceChainDetach' will be called with 'NULL'
@data as there is no backend for the disk.
The above case became possible once we allowed hotplug of cdroms and
subsequently fixed the case when users would hotplug an empty cdrom
which ultimately caused the possibility of having no backend in the
hotplug code path which was not possible before (see 'Fixes:' below and
also the commit linked from there).
Make 'qemuBlockStorageSourceChainDetach' tolerate NULL @data by simply
returning early.
Fixes: 894c6c5c1686cfbc1742493ed512a4795098b763
Resolves:
https://issues.redhat.com/browse/RHEL-54550
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
Reviewed-by: Martin Kletzander <mkletzan(a)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 d6cdf521c4..6e90bae9f2 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1927,6 +1927,9 @@ qemuBlockStorageSourceChainDetach(qemuMonitor *mon,
{
size_t i;
+ if (!data)
+ return;
+
if (data->copyOnReadAttached)
ignore_value(qemuMonitorBlockdevDel(mon, data->copyOnReadNodename));
--
2.46.0