mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Fix segfault in qemuDomainPrimeVirtioDeviceAddresses
On aarch64, lauch vm with the follow configuration:
<interface type="hostdev" managed="yes">
<mac address="fa:16:3e:14:41:00"/>
<source>
<address type="pci" domain="0x0000" bus="0x01" slot="0x0b" function="0x2"/>
</source>
</interface>
libvirtd will crash when accessing net->model.
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
committed by
Andrea Bolognani
parent
68c5d413ea
commit
6b00f4f41c
@@ -324,7 +324,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
||||
for (i = 0; i < def->nnets; i++) {
|
||||
virDomainNetDefPtr net = def->nets[i];
|
||||
|
||||
if (STREQ(net->model, "virtio") &&
|
||||
if (net->model &&
|
||||
STREQ(net->model, "virtio") &&
|
||||
net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
net->info.type = type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user