]> xenbits.xensource.com Git - libvirt.git/commit
conf: utility function to update entry in def->nets array
authorLaine Stump <laine@redhat.com>
Wed, 25 Sep 2019 16:42:51 +0000 (12:42 -0400)
committerLaine Stump <laine@redhat.com>
Thu, 26 Sep 2019 17:54:12 +0000 (13:54 -0400)
commit7e490cdad6364c82b326d5d9251826c757e8f77b
treebe22dfd424e5e9dc2d6ac7444670a4006ed859fc
parent4e9d72be02f47041787de8b501f0f7cd520ae826
conf: utility function to update entry in def->nets array

A virDomainNetDef object in a domain's nets array might contain a
virDomainHostdevDef, and when this is the case, the domain's hostdevs
array will also have a pointer to this embedded hostdev (this is done
so that internal functions that need to perform some operation on all
hostdevs won't leave out the type='hostdev' network interfaces).

When a network device was updated with virDomainUpdateDeviceFlags(),
we were replacing the entry in the nets array (and free'ing the
original) but forgetting about the pointer in the hostdevs array
(which would then point to the now-free'd hostdev contained in the old
net object.) This often resulted in a libvirtd crash.

The solution is to add a function, virDomainNetUpdate(), called by
qemuDomainUpdateDeviceConfig(), that updates the hostdevs array
appropriately along with the nets array.

Resolves: https://bugzilla.redhat.com/1558934

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/lxc/lxc_driver.c
src/qemu/qemu_driver.c