]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: Introduce mutex for bridge name generation
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 7 Jan 2021 14:51:02 +0000 (15:51 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 7 Jan 2021 19:26:08 +0000 (20:26 +0100)
commitea0cfa115307ecb9fe05dd1953ec7ddd8dd39d72
tree7d502fbad8658f6989dcdab1efe8ea5eac586fd6
parent225b363d50d9a5f678a79dde54db3879e6c83196
network: Introduce mutex for bridge name generation

When defining/creating a network the bridge name may be filled in
automatically by libvirt (if none provided in the input XML or
the one provided is a pattern, e.g. "virbr%d"). During the
bridge name generation process a candidate name is generated
which is then checked with the rest of already defined/running
networks for collisions.

Problem is, that there is no mutex guarding this critical section
and thus if two threads line up so that they both generate the
same candidate they won't find any collision and the same name is
then stored.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/78
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/network/bridge_driver.c