> netdev_open() would previously increment a netdev's refcount without
> holding a lock for it. This commit shifts the locking to protect it.
> 
> Found by inspection.
> 
> Signed-off-by: Joe Stringer <joestrin...@nicira.com>

Acked-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>

> ---
>  lib/netdev.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/netdev.c b/lib/netdev.c
> index 1bcd80f..fd20b05 100644
> --- a/lib/netdev.c
> +++ b/lib/netdev.c
> @@ -352,15 +352,15 @@ netdev_open(const char *name, const char *type, struct 
> netdev **netdevp)
>          error = 0;
>      }
>  
> -    ovs_mutex_unlock(&netdev_mutex);
> -    ovs_rwlock_unlock(&netdev_class_rwlock);
> -
>      if (!error) {
>          netdev->ref_cnt++;
>          *netdevp = netdev;
>      } else {
>          *netdevp = NULL;
>      }
> +    ovs_mutex_unlock(&netdev_mutex);
> +    ovs_rwlock_unlock(&netdev_class_rwlock);
> +
>      return error;
>  }
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to