]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: caps: Use unique key for domCaps caching
authorCole Robinson <crobinso@redhat.com>
Tue, 15 Oct 2019 15:47:10 +0000 (11:47 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 17 Oct 2019 18:59:41 +0000 (14:59 -0400)
commitfbf7c23c2dfae0ff879c98130c3765b4c1ebf34e
tree7f4af525735278f1d1c8cc7bcde058659d05b646
parentb83884d1a0f422e8147a7d1a39ccec0e0cca3285
qemu: caps: Use unique key for domCaps caching

When searching qemuCaps->domCapsCache for existing domCaps data,
we check for a matching pair of arch+virttype+machine+emulator. However
for the hash table key we only use the machine string. So if the
cache already contains:

  x86_64 + kvm + pc + /usr/bin/qemu-kvm

But a new VM is defined with

  x86_64 + qemu + pc + /usr/bin/qemu-kvm

We correctly fail to find matching cached domCaps, but then attempt
to use a colliding key with virHashAddEntry

Fix this by building a hash key from the 4 values, not just machine

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_conf.c