[ovs-dev] [PATCH] netdev-dpdk: Add missed lock in set_config for vhost client mode.

Ilya Maximets i.maximets at samsung.com
Fri Sep 23 13:17:56 UTC 2016


'vhost_driver_flags' and 'vhost_id' are mutable and must be protected
by 'dev->mutex'.

Fixes: 2d24d165d6a5 ("netdev-dpdk: Add new 'dpdkvhostuserclient' port type")
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---
 lib/netdev-dpdk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 89bdc4d..ec43a08 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1116,6 +1116,7 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
     const char *path;
 
+    ovs_mutex_lock(&dev->mutex);
     if (!(dev->vhost_driver_flags & RTE_VHOST_USER_CLIENT)) {
         path = smap_get(args, "vhost-server-path");
         if (path && strcmp(path, dev->vhost_id)) {
@@ -1123,6 +1124,7 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
             netdev_request_reconfigure(netdev);
         }
     }
+    ovs_mutex_unlock(&dev->mutex);
 
     return 0;
 }
-- 
2.7.4




More information about the dev mailing list