From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net 1/2] ipv6: route: enforce RCU protection in rt6_update_exception_stamp_rt()
Date: Wed, 20 Feb 2019 18:22:55 +0100 [thread overview]
Message-ID: <7bf3b6ff2f6d4f876783c3a154fd030805f55fc5.camel@redhat.com> (raw)
In-Reply-To: <1ac484e7626a5d5e7c22de13485575de30ad7fe0.1550682516.git.pabeni@redhat.com>
On Wed, 2019-02-20 at 18:10 +0100, Paolo Abeni wrote:
> We must access rt6_info->from under RCU read lock: move the
> dereference under such lock, with proper annotation, and use
> rcu_access_pointer() to check for null value outside the lock.
>
> Fixes: a68886a69180 ("net/ipv6: Make from in rt6_info rcu protected")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> net/ipv6/route.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index bd09abd1fb22..cbaa8745d9ff 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1610,15 +1610,15 @@ static int rt6_remove_exception_rt(struct rt6_info *rt)
> static void rt6_update_exception_stamp_rt(struct rt6_info *rt)
> {
> struct rt6_exception_bucket *bucket;
> - struct fib6_info *from = rt->from;
> struct in6_addr *src_key = NULL;
> struct rt6_exception *rt6_ex;
> + struct fib6_info *from;
>
> - if (!from ||
> - !(rt->rt6i_flags & RTF_CACHE))
> + if (!rcu_access_pointer(rt->from) || !(rt->rt6i_flags & RTF_CACHE))
> return;
>
> rcu_read_lock();
> + from = rcu_dereference(rt->from);
-ELOWONCOFFEE: even this one is racy, as rt->from can go away due to
underlying device removal between the two fetch operation.
I'll send a v2.
Again, I'm sorry for the noise,
Paolo
next prev parent reply other threads:[~2019-02-20 17:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 17:10 [PATCH net 0/2] ipv6: route: enforce RCU protection for fib6_info->from Paolo Abeni
2019-02-20 17:10 ` [PATCH net 1/2] ipv6: route: enforce RCU protection in rt6_update_exception_stamp_rt() Paolo Abeni
2019-02-20 17:22 ` Paolo Abeni [this message]
2019-02-20 19:28 ` David Miller
2019-02-20 17:10 ` [PATCH net 2/2] ipv6: route: enforce RCU protection in ip6_route_check_nh_onlink() Paolo Abeni
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=7bf3b6ff2f6d4f876783c3a154fd030805f55fc5.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).