[PATCH 3.16 010/305] ipv6: Fix another sparse warning on rt6i_node

From: Ben Hutchings
Date: Sun Feb 03 2019 - 09:05:33 EST


3.16.63-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Ben Hutchings <ben@xxxxxxxxxxxxxxx>

Commit 0933273ce750 "ipv6: fix sparse warning on rt6i_node" fixed some
sparse warnings in ip6_fib.c, but introduced a new one in
fib6_update_sernum() (which was removed before the corresponding
upstream commit).

fib6_update_sernum() is called in a RCU read-side section, so use
rcu_dereference() to read rt6_info::rt6i_node.

Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1681,10 +1681,10 @@ static void fib6_prune_clones(struct net
static int fib6_update_sernum(struct rt6_info *rt, void *arg)
{
__u32 sernum = *(__u32 *)arg;
+ struct fib6_node *fn = rcu_dereference(rt->rt6i_node);

- if (rt->rt6i_node &&
- rt->rt6i_node->fn_sernum != sernum)
- rt->rt6i_node->fn_sernum = sernum;
+ if (fn && fn->fn_sernum != sernum)
+ fn->fn_sernum = sernum;

return 0;
}