aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index af5d89792860..4a8e370862bc 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -71,6 +71,7 @@
71#include <linux/netlink.h> 71#include <linux/netlink.h>
72#include <linux/init.h> 72#include <linux/init.h>
73#include <linux/list.h> 73#include <linux/list.h>
74#include <linux/slab.h>
74#include <net/net_namespace.h> 75#include <net/net_namespace.h>
75#include <net/ip.h> 76#include <net/ip.h>
76#include <net/protocol.h> 77#include <net/protocol.h>
@@ -185,7 +186,9 @@ static inline struct tnode *node_parent_rcu(struct node *node)
185{ 186{
186 struct tnode *ret = node_parent(node); 187 struct tnode *ret = node_parent(node);
187 188
188 return rcu_dereference(ret); 189 return rcu_dereference_check(ret,
190 rcu_read_lock_held() ||
191 lockdep_rtnl_is_held());
189} 192}
190 193
191/* Same as rcu_assign_pointer 194/* Same as rcu_assign_pointer
@@ -208,7 +211,9 @@ static inline struct node *tnode_get_child_rcu(struct tnode *tn, unsigned int i)
208{ 211{
209 struct node *ret = tnode_get_child(tn, i); 212 struct node *ret = tnode_get_child(tn, i);
210 213
211 return rcu_dereference(ret); 214 return rcu_dereference_check(ret,
215 rcu_read_lock_held() ||
216 lockdep_rtnl_is_held());
212} 217}
213 218
214static inline int tnode_child_length(const struct tnode *tn) 219static inline int tnode_child_length(const struct tnode *tn)
@@ -961,7 +966,9 @@ fib_find_node(struct trie *t, u32 key)
961 struct node *n; 966 struct node *n;
962 967
963 pos = 0; 968 pos = 0;
964 n = rcu_dereference(t->trie); 969 n = rcu_dereference_check(t->trie,
970 rcu_read_lock_held() ||
971 lockdep_rtnl_is_held());
965 972
966 while (n != NULL && NODE_TYPE(n) == T_TNODE) { 973 while (n != NULL && NODE_TYPE(n) == T_TNODE) {
967 tn = (struct tnode *) n; 974 tn = (struct tnode *) n;
@@ -1017,8 +1024,6 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
1017 1024
1018 rcu_assign_pointer(t->trie, (struct node *)tn); 1025 rcu_assign_pointer(t->trie, (struct node *)tn);
1019 tnode_free_flush(); 1026 tnode_free_flush();
1020
1021 return;
1022} 1027}
1023 1028
1024/* only used from updater-side */ 1029/* only used from updater-side */
@@ -1750,7 +1755,9 @@ static struct leaf *leaf_walk_rcu(struct tnode *p, struct node *c)
1750 1755
1751static struct leaf *trie_firstleaf(struct trie *t) 1756static struct leaf *trie_firstleaf(struct trie *t)
1752{ 1757{
1753 struct tnode *n = (struct tnode *) rcu_dereference(t->trie); 1758 struct tnode *n = (struct tnode *) rcu_dereference_check(t->trie,
1759 rcu_read_lock_held() ||
1760 lockdep_rtnl_is_held());
1754 1761
1755 if (!n) 1762 if (!n)
1756 return NULL; 1763 return NULL;