]> xenbits.xensource.com Git - libvirt.git/commit
qemu_conf: Avoid dereferencing NULL in virQEMUDriverGetHost{NUMACaps,CPU}
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Jan 2020 09:24:45 +0000 (10:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Jan 2020 13:48:44 +0000 (14:48 +0100)
commitcc361a34c53210d682dbc5f2d506b4a23b71e399
tree7fc16046b6f5cf25d20a39822cebf932aee6c276
parent609acf1f5d5d666148355719346c8ee05f911e33
qemu_conf: Avoid dereferencing NULL in virQEMUDriverGetHost{NUMACaps,CPU}

When fixing [1] I've ran attached reproducer and had it spawn
1024 threads and query capabilities XML in each one of them. This
lead libvirtd to hit the RLIMIT_NOFILE limit which was kind of
expected. What wasn't expected was a subsequent segfault. It
happened because virCPUProbeHost failed and returned NULL. We've
taken the NULL and passed it to virCapabilitiesHostNUMARef()
which dereferenced it. Code inspection showed the same flas in
virQEMUDriverGetHostNUMACaps(), so I'm fixing both places.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_conf.c