[ovs-dev] [PATCH 2/3] netdev-dummy: Fix synchronization error in netdev_dummy_get_config().

Ben Pfaff blp at nicira.com
Mon Aug 12 19:54:06 UTC 2013


Found by Clang.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/netdev-dummy.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 5c31210..32b0943 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -327,12 +327,15 @@ netdev_dummy_get_config(const struct netdev *netdev_, struct smap *args)
 {
     struct netdev_dummy *netdev = netdev_dummy_cast(netdev_);
 
+    ovs_mutex_lock(&netdev->mutex);
     if (netdev->ifindex >= 0) {
         smap_add_format(args, "ifindex", "%d", netdev->ifindex);
     }
     if (netdev->pstream) {
         smap_add(args, "pstream", pstream_get_name(netdev->pstream));
     }
+    ovs_mutex_unlock(&netdev->mutex);
+
     return 0;
 }
 
-- 
1.7.10.4




More information about the dev mailing list