diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 18:50:21 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 01:39:34 -0400 |
commit | 728cbc6ac1eef89660875c70a602c1a0ba8df4ff (patch) | |
tree | fcdf37937b1f01494400a0e8d57490360c64cdc3 /net | |
parent | 704509b8d44886cebfbaff1a9813c35dfa986954 (diff) |
batman-adv: Use rcu_dereference_protected by update-side
Usually rcu_dereference isn't necessary in situations were the
RCU-protected data structure cannot change, but sparse and lockdep still
need a similar functionality for analysis. rcu_dereference_protected
implements the reduced version which should be used to support the
dynamic and static analysis.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/gateway_client.c | 2 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 2 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index a44dff3efb7f..ab597c4f9ddd 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -86,7 +86,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node) | |||
86 | if (new_gw_node && !atomic_inc_not_zero(&new_gw_node->refcount)) | 86 | if (new_gw_node && !atomic_inc_not_zero(&new_gw_node->refcount)) |
87 | new_gw_node = NULL; | 87 | new_gw_node = NULL; |
88 | 88 | ||
89 | curr_gw_node = bat_priv->curr_gw; | 89 | curr_gw_node = rcu_dereference_protected(bat_priv->curr_gw, 1); |
90 | rcu_assign_pointer(bat_priv->curr_gw, new_gw_node); | 90 | rcu_assign_pointer(bat_priv->curr_gw, new_gw_node); |
91 | 91 | ||
92 | if (curr_gw_node) | 92 | if (curr_gw_node) |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index e0052cf389db..a3fbfb5c92f1 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -138,7 +138,7 @@ static void primary_if_select(struct bat_priv *bat_priv, | |||
138 | if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount)) | 138 | if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount)) |
139 | new_hard_iface = NULL; | 139 | new_hard_iface = NULL; |
140 | 140 | ||
141 | curr_hard_iface = bat_priv->primary_if; | 141 | curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1); |
142 | rcu_assign_pointer(bat_priv->primary_if, new_hard_iface); | 142 | rcu_assign_pointer(bat_priv->primary_if, new_hard_iface); |
143 | 143 | ||
144 | if (curr_hard_iface) | 144 | if (curr_hard_iface) |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index cead606008a1..b8d3f248efdc 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -241,7 +241,8 @@ static void softif_neigh_vid_select(struct bat_priv *bat_priv, | |||
241 | if (new_neigh && !atomic_inc_not_zero(&new_neigh->refcount)) | 241 | if (new_neigh && !atomic_inc_not_zero(&new_neigh->refcount)) |
242 | new_neigh = NULL; | 242 | new_neigh = NULL; |
243 | 243 | ||
244 | curr_neigh = softif_neigh_vid->softif_neigh; | 244 | curr_neigh = rcu_dereference_protected(softif_neigh_vid->softif_neigh, |
245 | 1); | ||
245 | rcu_assign_pointer(softif_neigh_vid->softif_neigh, new_neigh); | 246 | rcu_assign_pointer(softif_neigh_vid->softif_neigh, new_neigh); |
246 | 247 | ||
247 | if ((curr_neigh) && (!new_neigh)) | 248 | if ((curr_neigh) && (!new_neigh)) |