]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: block: Allow NULL 'data' in 'qemuBlockStorageSourceChainDetach'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Aug 2024 14:08:53 +0000 (16:08 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 21 Aug 2024 13:49:36 +0000 (15:49 +0200)
commit204013d4aa95e6843ae2ef01f9e59c57cf77db1c
tree66db217dcb749fedd9ac7d6600b0e7fde3b367eb
parent85e07fb1ceee7943879f8a374cabfa8ab858a3c6
qemu: block: Allow NULL 'data' in 'qemuBlockStorageSourceChainDetach'

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@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_block.c