nwfilter: fix crash when counting number of network filters
nwfilter: fix crash when counting number of network filters

The virNWFilterObjListNumOfNWFilters method iterates over the
driver->nwfilters, accessing virNWFilterObj instances. As such
it needs to be protected against concurrent modification of
the driver->nwfilters object.

This API allows unprivileged users to connect, so users with
read-only access to libvirt can cause a denial of service
crash if they are able to race with a call of virNWFilterUndefine.
Since network filters are usually statically defined, this is
considered a low severity problem.

This is assigned CVE-2022-0897.

Reviewed-by: Eric Blake <a9da18479c871fe903d9590822cfe2629c6a4d11@redhat.com>
Signed-off-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

libvirt/libvirt,zippy2/libvirt,jfehlig/libvirt,jfehlig/libvirt,crobinso/libvirt,zippy2/libvirt,olafhering/libvirt,zippy2/libvirt,jfehlig/libvirt,zippy2/libvirt,olafhering/libvirt,libvirt/libvirt,olafhering/libvirt,libvirt/libvirt,libvirt/libvirt,jfehlig/libvirt,crobinso/libvirt,crobinso/libvirt,olafhering/libvirt,crobinso/libvirt