netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next] net/ipv6: prefer rcu_access_pointer() over rcu_dereference()
Date: Fri, 15 Feb 2019 15:13:06 -0700	[thread overview]
Message-ID: <2e26b615-65e9-96b3-d1fa-e72116320030@gmail.com> (raw)
In-Reply-To: <52d4aee68b816ce36c0d4f4398ae143a2ebbdba4.1550249827.git.pabeni@redhat.com>

On 2/15/19 10:15 AM, Paolo Abeni wrote:
> rt6_cache_allowed_for_pmtu() checks for rt->from presence, but
> it does not access the RCU protected pointer. We can use
> rcu_access_pointer() and clean-up the code a bit. No functional
> changes intended.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  net/ipv6/route.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index dc066fdf7e46..87a0561136dd 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2277,14 +2277,8 @@ static void rt6_do_update_pmtu(struct rt6_info *rt, u32 mtu)
>  
>  static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)
>  {
> -	bool from_set;
> -
> -	rcu_read_lock();
> -	from_set = !!rcu_dereference(rt->from);
> -	rcu_read_unlock();
> -
>  	return !(rt->rt6i_flags & RTF_CACHE) &&
> -		(rt->rt6i_flags & RTF_PCPU || from_set);
> +		(rt->rt6i_flags & RTF_PCPU || rcu_access_pointer(rt->from));
>  }
>  
>  static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
> 

good cleanup

Reviewed-by: David Ahern <dsahern@gmail.com>

  reply	other threads:[~2019-02-15 22:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 17:15 [PATCH net-next] net/ipv6: prefer rcu_access_pointer() over rcu_dereference() Paolo Abeni
2019-02-15 22:13 ` David Ahern [this message]
2019-02-16  4:26 ` David Miller

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=2e26b615-65e9-96b3-d1fa-e72116320030@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).