]> xenbits.xensource.com Git - libvirt.git/commit
qemu_block: Validate number of hosts for iSCSI disk device
authorRayhan Faizel <rayhan.faizel@gmail.com>
Thu, 6 Jun 2024 14:27:51 +0000 (19:57 +0530)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 25 Jun 2024 08:05:49 +0000 (10:05 +0200)
commit9b0606ef8e77e02d073507f82e470270a9a1a818
tree12c71e27488c5bd6daabea9ebdb8ce63cad8592b
parent1cc7737f69e586991d63e9f5589517a092c4ea53
qemu_block: Validate number of hosts for iSCSI disk device

An iSCSI device with zero hosts will result in a segmentation fault. This patch
adds a check for the number of hosts, which must be one in the case of iSCSI.

Minimal reproducing XML:

<domain type='qemu'>
    <name>MyGuest</name>
    <uuid>4dea22b3-1d52-d8f3-2516-782e98ab3fa0</uuid>
    <os>
        <type arch='x86_64'>hvm</type>
    </os>
    <memory>4096</memory>
    <devices>
        <disk type='network'>
            <source name='dummy' protocol='iscsi'/>
            <target dev='vda'/>
        </disk>
    </devices>
</domain>

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_block.c
tests/qemuxmlconfdata/disk-network-iscsi-zero-hosts-invalid.x86_64-latest.err [new file with mode: 0644]
tests/qemuxmlconfdata/disk-network-iscsi-zero-hosts-invalid.x86_64-latest.xml [new file with mode: 0644]
tests/qemuxmlconfdata/disk-network-iscsi-zero-hosts-invalid.xml [new file with mode: 0644]
tests/qemuxmlconftest.c