batman-adv: Fix non-atomic bla_claim::backbone_gw access
authorSven Eckelmann <sven@narfation.org>
Fri, 1 Jul 2016 13:49:43 +0000 (15:49 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Tue, 5 Jul 2016 10:43:21 +0000 (12:43 +0200)
commit3db0decf1185357d6ab2256d0dede1ca9efda03d
tree1fc52de94b2acd9bee5823169e8c0883adec1c9d
parent33fbb1f3db87ce53da925b3e034b4dd446d483f8
batman-adv: Fix non-atomic bla_claim::backbone_gw access

The pointer batadv_bla_claim::backbone_gw can be changed at any time.
Therefore, access to it must be protected to ensure that two function
accessing the same backbone_gw are actually accessing the same. This is
especially important when the crc_lock is used or when the backbone_gw of a
claim is exchanged.

Not doing so leads to invalid memory access and/or reference leaks.

Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
Fixes: 5a1dd8a4773d ("batman-adv: lock crc access in bridge loop avoidance")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/types.h