
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> git-svn-id: svn://svn.openwrt.org/openwrt/packages@22823 3c298f89-4303-0410-b956-a3cf2f4a3e73
80 lines
2.4 KiB
Diff
80 lines
2.4 KiB
Diff
From 3680f6998508e0a2a22bad3837028d172bb197b1 Mon Sep 17 00:00:00 2001
|
|
From: Marek Lindner <lindner_marek@yahoo.de>
|
|
Date: Sun, 8 Aug 2010 13:01:11 +0000
|
|
Subject: [PATCH 04/10] batman-adv: unify orig_hash_lock spinlock handling to avoid deadlocks
|
|
|
|
The orig_hash_lock spinlock always has to be locked with IRQs being
|
|
disabled to avoid deadlocks between code that is being executed in
|
|
IRQ context and code that is being executed in non-IRQ context.
|
|
|
|
Reported-by: Sven Eckelmann <sven.eckelmann@gmx.de>
|
|
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
|
|
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
|
|
---
|
|
originator.c | 14 ++++++++------
|
|
1 files changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/originator.c b/originator.c
|
|
index 9fa1ac3..068210a 100644
|
|
--- a/originator.c
|
|
+++ b/originator.c
|
|
@@ -392,11 +392,12 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
|
|
int orig_hash_add_if(struct batman_if *batman_if, int max_if_num)
|
|
{
|
|
struct orig_node *orig_node;
|
|
+ unsigned long flags;
|
|
HASHIT(hashit);
|
|
|
|
/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
|
|
* if_num */
|
|
- spin_lock(&orig_hash_lock);
|
|
+ spin_lock_irqsave(&orig_hash_lock, flags);
|
|
|
|
while (hash_iterate(orig_hash, &hashit)) {
|
|
orig_node = hashit.bucket->data;
|
|
@@ -405,11 +406,11 @@ int orig_hash_add_if(struct batman_if *batman_if, int max_if_num)
|
|
goto err;
|
|
}
|
|
|
|
- spin_unlock(&orig_hash_lock);
|
|
+ spin_unlock_irqrestore(&orig_hash_lock, flags);
|
|
return 0;
|
|
|
|
err:
|
|
- spin_unlock(&orig_hash_lock);
|
|
+ spin_unlock_irqrestore(&orig_hash_lock, flags);
|
|
return -ENOMEM;
|
|
}
|
|
|
|
@@ -469,12 +470,13 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
|
|
{
|
|
struct batman_if *batman_if_tmp;
|
|
struct orig_node *orig_node;
|
|
+ unsigned long flags;
|
|
HASHIT(hashit);
|
|
int ret;
|
|
|
|
/* resize all orig nodes because orig_node->bcast_own(_sum) depend on
|
|
* if_num */
|
|
- spin_lock(&orig_hash_lock);
|
|
+ spin_lock_irqsave(&orig_hash_lock, flags);
|
|
|
|
while (hash_iterate(orig_hash, &hashit)) {
|
|
orig_node = hashit.bucket->data;
|
|
@@ -501,10 +503,10 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
|
|
rcu_read_unlock();
|
|
|
|
batman_if->if_num = -1;
|
|
- spin_unlock(&orig_hash_lock);
|
|
+ spin_unlock_irqrestore(&orig_hash_lock, flags);
|
|
return 0;
|
|
|
|
err:
|
|
- spin_unlock(&orig_hash_lock);
|
|
+ spin_unlock_irqrestore(&orig_hash_lock, flags);
|
|
return -ENOMEM;
|
|
}
|
|
--
|
|
1.7.1
|
|
|