From: Eric Dumazet <eric.dumazet@gmail.com>
To: Pravin B Shelar <pshelar@nicira.com>
Cc: netdev@vger.kernel.org, Jesse Gross <jesse@nicira.com>
Subject: Re: [PATCH net] vxlan: Use RCU apis to access sk_user_data.
Date: Mon, 23 Sep 2013 22:51:16 -0700 [thread overview]
Message-ID: <1380001876.3165.44.camel@edumazet-glaptop> (raw)
In-Reply-To: <1380000501-13969-1-git-send-email-pshelar@nicira.com>
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@nicira.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.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)
next prev parent reply other threads:[~2013-09-24 5:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 5:28 [PATCH net] vxlan: Use RCU apis to access sk_user_data Pravin B Shelar
2013-09-24 5:51 ` Eric Dumazet [this message]
2013-09-24 16:20 ` Stephen Hemminger
2013-09-24 16:27 ` Pravin Shelar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380001876.3165.44.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=jesse@nicira.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox