]> xenbits.xensource.com Git - libvirt.git/commit
virNWFilterLockIface: Preserve correct lock ordering
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 18 Mar 2022 16:14:54 +0000 (17:14 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 18 Mar 2022 16:45:17 +0000 (17:45 +0100)
commitaf6f6091e02bb46633666ce30d4c6533a52688a5
tree42842c0819bf47efb187c463efa7de5d7e752aea
parentdb7b0b12b7b07b8a0313161e3cbedb38a74e5954
virNWFilterLockIface: Preserve correct lock ordering

In the not so distant past, the lock ordering in
virNWFilterLockIface() was as follows: global mutex ifaceMapLock
was acquired, then internal representation of given interface was
looked up in a hash table (or created brand new if none was
found), the global lock was released and the lock of the
interface was acquired.

But this was mistakenly changed as the function was rewritten to
use automatic mutexes, because now the global lock is held
throughout the whole run of the function and thus the interface
specific lock is acquired with the global lock held. This results
in a deadlock.

Fixes: dd8150c48dcf94e8d3b0481be08eeef822b98b02
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/nwfilter/nwfilter_learnipaddr.c