]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: fix crash when hotplug a channel chr device with no target
authorLuyao Huang <lhuang@redhat.com>
Tue, 13 Jan 2015 08:41:05 +0000 (16:41 +0800)
committerJán Tomko <jtomko@redhat.com>
Tue, 13 Jan 2015 08:56:56 +0000 (09:56 +0100)
commitfba7173f7236c705344aa84bf9715074abdc6ea7
tree008383b28fe6d49193c7115da16ce7ed1dde1780
parentadff345e1ec9a6f528731ae40168a76b8e7620e0
conf: fix crash when hotplug a channel chr device with no target

https://bugzilla.redhat.com/show_bug.cgi?id=1181408

When we try to hotplug a channel chr device with no target, we
will get success (which should fail) in virDomainChrDefParseXML,
because we use goto cleanup this place and return an incomplete
definition (with no target). In qemuDomainAttachChrDevice,
we add it to the domain definition, but fail to remove it from
there when chardev-add fails, because virDomainChrRemove
matches chardevices according to the target name.
The device definition is then freed in qemuDomainAttachDeviceFlags,
leaving a stale pointer in the domain definition.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c