]> xenbits.xensource.com Git - libvirt.git/commit
virnwfilterbindingobj: Fix virNWFilterBindingObjNew()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 1 Feb 2022 09:21:02 +0000 (10:21 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 1 Feb 2022 10:55:13 +0000 (11:55 +0100)
commita7201789ab9ef0fdb0f5e458b301de4232710a18
tree3b6a662421be4a6bbef438d77e779e0d72750c9a
parent5e0b2aeb2977c3b5c9ff722732304b777f83281b
virnwfilterbindingobj: Fix virNWFilterBindingObjNew()

The idea behind virNWFilterBindingObjNew() is to create and
return an object of virNWFilterBindingObjClass class. The class
is virObjectLockable (and the corresponding
_virNWFilterBindingObj structure has virObjectLockable parent).
But for some reason plain virObjectNew() is called. This is wrong
because the mutex in the parent is left uninitialized.

Next, the returned object is not locked. This is wrong because in
some cases the returned object is added onto a list of bindings
and then passed to virNWFilterBindingObjEndAPI() which unlocks it
right away. This is potentially dangerous because we might just
have unlocked the object for another thread.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/virnwfilterbindingobj.c