The virNetDevGenerateName() function uses a global array of
virNetDevGenName structs to find next unused name for network
device. This obviously needs some locking and in fact each member
of the array has its own lock. However, these members are not
virObjects, they are just plain structs, therefore
VIR_WITH_MUTEX_LOCK_GUARD() must be used instead of
VIR_WITH_OBJECT_LOCK_GUARD() to lock individual mutexes.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virnetdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 5df48af60c..1c15a475fa 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3616,7 +3616,7 @@ virNetDevGenerateName(char **ifname, virNetDevGenNameType type)
g_autofree char *try = NULL;
int id = 0;
- VIR_WITH_OBJECT_LOCK_GUARD(&virNetDevGenNames[type].mutex) {
+ VIR_WITH_MUTEX_LOCK_GUARD(&virNetDevGenNames[type].mutex) {
id = ++virNetDevGenNames[type].lastID;
/* reset before overflow */
--
2.34.1