Skip to content

Commit

Permalink
net/ipv6: prefer rcu_access_pointer() over rcu_dereference()
Browse files Browse the repository at this point in the history
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>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Paolo Abeni authored and David S. Miller committed Feb 16, 2019
1 parent 59e6158 commit 1490ed2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1490ed2

Please sign in to comment.