diff mbox

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

Message ID 1474636678-20649-1-git-send-email-i.maximets@samsung.com
State Accepted
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Ilya Maximets Sept. 23, 2016, 1:17 p.m. UTC
'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@samsung.com>
---
 lib/netdev-dpdk.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniele Di Proietto Sept. 23, 2016, 8:57 p.m. UTC | #1
Thanks for the fix, applied to master and branch-2.6




On 23/09/2016 06:17, "Ilya Maximets" <i.maximets@samsung.com> wrote:

>'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@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

>
diff mbox

Patch

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;
 }