]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Fix check for chardev source path
authorAndrea Bolognani <abologna@redhat.com>
Thu, 6 Sep 2018 15:51:10 +0000 (17:51 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 7 Sep 2018 15:18:21 +0000 (17:18 +0200)
commit614193fac67445a7e92bf620ffef726ed1bd6f07
tree36780c57839ee042175c7259f7ed42120c4df974
parentdf6dc485bb3f3754a44e658d10db653fd4edf9c6
conf: Fix check for chardev source path

Attempting to use a chardev definition like

  <serial type='unix'>
    <target type='isa-serial'/>
  </serial>

correctly results in an error being reported, since the source
path - a required piece of information - is missing; however,
the very similar

  <serial type='unix'>
    <target type='pci-serial'/>
  </serial>

was happily accepted by libvirt, only to result in libvirtd
crashing as soon as the guest was started.

The issue was caused by checking the chardev's targetType
against whitelisted values from virDomainChrChannelTargetType
without first checking the chardev's deviceType to make sure
it is actually a channel, for which the check makes sense,
rather than a different type of chardev.

The only reason this wasn't spotted earlier is that the
whitelisted values just so happen to correspond to USB and
PCI serial devices and Xen and UML consoles respectively,
all of which are fairly uncommon.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
tests/qemuxml2argvdata/serial-unix-missing-source.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c