summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@web.de>2011-03-14 23:43:40 +0100
committerSven Eckelmann <sven@narfation.org>2011-04-17 21:11:01 +0200
commit68003903e4eeec5288f074ff0751a381750ceb34 (patch)
tree72577cb46c0e0aaec9edb54a496002d13650f6fb /net/batman-adv/routing.c
parentbatman-adv: Make orig_node->router an rcu protected pointer (diff)
downloadlinux-68003903e4eeec5288f074ff0751a381750ceb34.tar.xz
linux-68003903e4eeec5288f074ff0751a381750ceb34.zip
batman-adv: Protect global TQ window with a spinlock
Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b7d43caaa9c8..f6c642246972 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -415,10 +415,12 @@ static void update_orig(struct bat_priv *bat_priv,
if (is_duplicate)
continue;
+ spin_lock_bh(&tmp_neigh_node->tq_lock);
ring_buffer_set(tmp_neigh_node->tq_recv,
&tmp_neigh_node->tq_index, 0);
tmp_neigh_node->tq_avg =
ring_buffer_avg(tmp_neigh_node->tq_recv);
+ spin_unlock_bh(&tmp_neigh_node->tq_lock);
}
if (!neigh_node) {
@@ -443,10 +445,12 @@ static void update_orig(struct bat_priv *bat_priv,
orig_node->flags = batman_packet->flags;
neigh_node->last_valid = jiffies;
+ spin_lock_bh(&neigh_node->tq_lock);
ring_buffer_set(neigh_node->tq_recv,
&neigh_node->tq_index,
batman_packet->tq);
neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv);
+ spin_unlock_bh(&neigh_node->tq_lock);
if (!is_duplicate) {
orig_node->last_ttl = batman_packet->ttl;