Patch "ipv6: fix sparse warning on rt6i_node" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
ipv6: fix sparse warning on rt6i_node
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ipv6-fix-sparse-warning-on-rt6i_node.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Sep 15 10:03:45 PDT 2017
From: Wei Wang <[email protected]>
Date: Fri, 25 Aug 2017 15:03:10 -0700
Subject: ipv6: fix sparse warning on rt6i_node
From: Wei Wang <[email protected]>
[ Upstream commit 4e587ea71bf924f7dac621f1351653bd41e446cb ]
Commit c5cff8561d2d adds rcu grace period before freeing fib6_node. This generates a new sparse warning on rt->rt6i_node related code:
net/ipv6/route.c:1394:30: error: incompatible types in comparison expression (different address spaces) ./include/net/ip6_fib.h:187:14: error: incompatible types in comparison expression (different address spaces)
This commit adds "__rcu" tag for rt6i_node and makes sure corresponding rcu API is used for it.
After this fix, sparse no longer generates the above warning.
--- include/net/ip6_fib.h | 2 +- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_fib.c | 11 +++++++---- net/ipv6/route.c | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-)
include/net/ip6_fib.h +1 -1
@@ -103,7 +103,7 @@ struct rt6_info {* the same cache line. */ struct fib6_table *rt6i_table; -struct fib6_node *rt6i_node; +struct fib6_node __rcu *rt6i_node;struct in6_addr rt6i_gateway;
net/ipv6/addrconf.c +1 -1
@@ -5152,7 +5152,7 @@ static void __ipv6_ifa_notify(int event,* our DAD process, so we don't need * to do it again */ -if (!(ifp->rt->rt6i_node)) +if (!rcu_access_pointer (ifp->rt->rt6i_node))ip6_ins_rt (ifp->rt);if (ifp->idev->cnf.forwarding)addrconf_join_anycast (ifp);
net/ipv6/ip6_fib.c +7 -4
@@ -869,7 +869,7 @@ add: rt->dst.rt6_next = iter; *ins = rt; - rt->rt6i_node = fn; +rcu_assign_pointer (rt->rt6i_node, fn);atomic_inc (&rt->rt6i_ref);inet6_rt_notify (RTM_NEWROUTE , rt, info,0 ); info->nl_net->ipv6.rt6_stats->fib_rt_entries++;
@@ -894,7 +894,7 @@ add:return err; *ins = rt; - rt->rt6i_node = fn; +rcu_assign_pointer (rt->rt6i_node, fn); rt->dst.rt6_next = iter->dst.rt6_next;atomic_inc (&rt->rt6i_ref);inet6_rt_notify (RTM_NEWROUTE , rt, info,NLM_F_REPLACE );
@@ -1454,8 +1454,9 @@ static void fib6_del_route(struct fib6_nint fib6_del (struct rt6_info *rt,struct nl_info *info) { +struct fib6_node *fn =rcu_dereference_protected (rt->rt6i_node, +lockdep_is_held (&rt->rt6i_table->tb6_lock));struct net *net = info->nl_net; -struct fib6_node *fn = rt->rt6i_node;struct rt6_info **rtp;#if RT6_DEBUG >=2
@@ -1644,7 +1645,9 @@ static int fib6_clean_node(struct fib6_wif (res) {#if RT6_DEBUG >=2 pr_debug ("%s: del failed: rt=%p@%p err=%d\n" , - __func__, rt, rt->rt6i_node, res); + __func__, rt, +rcu_access_pointer (rt->rt6i_node), + res);#endif continue ; }
net/ipv6/route.c +2 -1
@@ -1342,7 +1342,8 @@ static void rt6_do_update_pmtu(struct rtstatic bool rt6_cache_allowed_for_pmtu (const struct rt6_info *rt) {return !(rt->rt6i_flags &RTF_CACHE ) && - (rt->rt6i_flags &RTF_PCPU || rt->rt6i_node); + (rt->rt6i_flags &RTF_PCPU || +rcu_access_pointer (rt->rt6i_node)); } static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/ipv6-fix-sparse-warning-on-rt6i_node.patch queue-4.4/tcp-initialize-rcv_mss-to-tcp_min_mss-instead-of-0.patch queue-4.4/ipv6-add-rcu-grace-period-before-freeing-fib6_node.patch