diff mbox

[ovs-dev] netdev-dpdk: Don't use dev->vhost_id without mutex.

Message ID 1480918467-2517-1-git-send-email-i.maximets@samsung.com
State Superseded
Headers show

Commit Message

Ilya Maximets Dec. 5, 2016, 6:14 a.m. UTC
The copy should be used here.

Fixes: 821b86649a90 ("netdev-dpdk: Don't try to unregister empty vhost_id.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/netdev-dpdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Dec. 5, 2016, 4:32 p.m. UTC | #1
How about "if (!vhost_id[0])", to avoid a useless strlen call?

On Mon, Dec 05, 2016 at 09:14:27AM +0300, Ilya Maximets wrote:
> The copy should be used here.
> 
> Fixes: 821b86649a90 ("netdev-dpdk: Don't try to unregister empty vhost_id.")
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
>  lib/netdev-dpdk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 6e5cd43..e06aa28 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -1027,7 +1027,7 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
>      ovs_mutex_unlock(&dev->mutex);
>      ovs_mutex_unlock(&dpdk_mutex);
>  
> -    if (!strlen(dev->vhost_id)) {
> +    if (!strlen(vhost_id)) {
>          goto out;
>      }
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ilya Maximets Dec. 6, 2016, 7:10 a.m. UTC | #2
> How about "if (!vhost_id[0])", to avoid a useless strlen call?

LGTM, I've posted v2 with that fix:
https://mail.openvswitch.org/pipermail/ovs-dev/2016-December/325807.html

Best regards, Ilya Maximets.
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 6e5cd43..e06aa28 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1027,7 +1027,7 @@  netdev_dpdk_vhost_destruct(struct netdev *netdev)
     ovs_mutex_unlock(&dev->mutex);
     ovs_mutex_unlock(&dpdk_mutex);
 
-    if (!strlen(dev->vhost_id)) {
+    if (!strlen(vhost_id)) {
         goto out;
     }