[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1380001876.3165.44.camel@edumazet-glaptop>
Date: Mon, 23 Sep 2013 22:51:16 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Pravin B Shelar <pshelar@...ira.com>
Cc: netdev@...r.kernel.org, Jesse Gross <jesse@...ira.com>
Subject: Re: [PATCH net] vxlan: Use RCU apis to access sk_user_data.
On Mon, 2013-09-23 at 22:28 -0700, Pravin B Shelar wrote:
> Use of RCU api makes vxlan code easier to understand. It also
> fixes bug due to missing ACCESS_ONCE() on sk_user_data dereference.
> In rare case without ACCESS_ONCE() compiler might omit vs on
> sk_user_data dereference.
> Compiler can use vs as alias for sk->sk_user_data, resulting in
> multiple sk_user_data dereference in rcu read context which
> could change.
>
> CC: Jesse Gross <jesse@...ira.com>
> Signed-off-by: Pravin B Shelar <pshelar@...ira.com>
> ---
> drivers/net/vxlan.c | 9 +++------
> include/net/sock.h | 2 ++
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index d1292fe..3519a71 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -952,8 +952,7 @@ void vxlan_sock_release(struct vxlan_sock *vs)
>
> spin_lock(&vn->sock_lock);
> hlist_del_rcu(&vs->hlist);
> - smp_wmb();
> - vs->sock->sk->sk_user_data = NULL;
> + rcu_assign_pointer(sk_user_data_rcu(vs->sock->sk), NULL);
RCU_INIT_POINTER(sk_user_data_rcu(vs->sock->sk), NULL)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists