summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-05-07 07:00:07 +0200
committerIngo Molnar <mingo@kernel.org>2016-05-07 07:00:07 +0200
commit35dc9ec1076b79c31bf7ed538af008b7f23bb14d (patch)
treef90affdd5dc45f47f8d5d84ea34c71e5e521e7a1 /net/batman-adv/routing.c
parent0ec7ae928a9c19c2b7b8054507d5694a2597065e (diff)
parent07837831047fb72856d1f61a726a4094397facd8 (diff)
downloadblackbird-op-linux-35dc9ec1076b79c31bf7ed538af008b7f23bb14d.tar.gz
blackbird-op-linux-35dc9ec1076b79c31bf7ed538af008b7f23bb14d.zip
Merge branch 'linus' into efi/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4dd646a52f1a..b781bf753250 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
neigh_node = NULL;
spin_lock_bh(&orig_node->neigh_list_lock);
+ /* curr_router used earlier may not be the current orig_ifinfo->router
+ * anymore because it was dereferenced outside of the neigh_list_lock
+ * protected region. After the new best neighbor has replace the current
+ * best neighbor the reference counter needs to decrease. Consequently,
+ * the code needs to ensure the curr_router variable contains a pointer
+ * to the replaced best neighbor.
+ */
+ curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+
rcu_assign_pointer(orig_ifinfo->router, neigh_node);
spin_unlock_bh(&orig_node->neigh_list_lock);
batadv_orig_ifinfo_put(orig_ifinfo);
OpenPOWER on IntegriCloud