mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
qemu: Prevent crash of libvirtd without guest agent
* src/qemu/qemu_process.c (qemuFindAgentConfig): avoid crash libvirtd due to
deref a NULL pointer.
* How to reproduce?
1. virsh edit the following xml into guest configuration:
<channel type='pty'>
<target type='virtio'/>
</channel>
2. virsh start <domain>
or
% virt-install -n foo -r 1024 --disk path=/var/lib/libvirt/images/foo.img,size=1 \
--channel pty,target_type=virtio -l <installation tree>
Signed-off-by: Alex Jia <ajia@redhat.com>
This commit is contained in:
@@ -194,7 +194,7 @@ qemuFindAgentConfig(virDomainDefPtr def)
|
||||
if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
|
||||
continue;
|
||||
|
||||
if (STREQ(channel->target.name, "org.qemu.guest_agent.0")) {
|
||||
if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0")) {
|
||||
config = &channel->source;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user