summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/types.h
diff options
context:
space:
mode:
authorSimon Wunderlich2015-09-11 18:04:13 +0200
committerAntonio Quartulli2015-12-16 08:17:09 +0100
commit5a1dd8a4773d4c24e925cc6154826d555a85c370 (patch)
tree60e9944e19fe8b52ef0e63667eb8af7cb7b85662 /net/batman-adv/types.h
parentbatman-adv: Fix typo 'wether' -> 'whether' (diff)
downloadkernel-qcow2-linux-5a1dd8a4773d4c24e925cc6154826d555a85c370.tar.gz
kernel-qcow2-linux-5a1dd8a4773d4c24e925cc6154826d555a85c370.tar.xz
kernel-qcow2-linux-5a1dd8a4773d4c24e925cc6154826d555a85c370.zip
batman-adv: lock crc access in bridge loop avoidance
We have found some networks in which nodes were constantly requesting other nodes BLA claim tables to synchronize, just to ask for that again once completed. The reason was that the crc checksum of the asked nodes were out of sync due to missing locking and multiple writes to the same crc checksum when adding/removing entries. Therefore the asked nodes constantly reported the wrong crc, which caused repeating requests. To avoid multiple functions changing a backbone gateways crc entry at the same time, lock it using a spinlock. Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Tested-by: Alfons Name <AlfonsName@web.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/types.h')
-rw-r--r--net/batman-adv/types.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9bdb21c2368a..7c386dbb75f0 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -906,6 +906,7 @@ struct batadv_socket_packet {
* backbone gateway - no bcast traffic is formwared until the situation was
* resolved
* @crc: crc16 checksum over all claims
+ * @crc_lock: lock protecting crc
* @refcount: number of contexts the object is used
* @rcu: struct used for freeing in an RCU-safe manner
*/
@@ -919,6 +920,7 @@ struct batadv_bla_backbone_gw {
atomic_t wait_periods;
atomic_t request_sent;
u16 crc;
+ spinlock_t crc_lock; /* protects crc */
atomic_t refcount;
struct rcu_head rcu;
};