summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/types.h
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2011-02-10 14:33:49 +0000
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 12:50:04 +0100
commit25b6d3c17eaa92ae9700eb8235bc79782613354a (patch)
tree1c9949a6adf8144f77b91e9f3a785d0557525f39 /net/batman-adv/types.h
parent44524fcdf6ca19b58c24f7622c4af1d8d8fe59f8 (diff)
downloadlinux-25b6d3c17eaa92ae9700eb8235bc79782613354a.tar.bz2
batman-adv: Correct rcu refcounting for gw_node
It might be possible that 2 threads access the same data in the same rcu grace period. The first thread calls call_rcu() to decrement the refcount and free the data while the second thread increases the refcount to use the data. To avoid this race condition all refcount operations have to be atomic. Reported-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/types.h')
-rw-r--r--net/batman-adv/types.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 084604a6dcf1..cfbeb45cd9b3 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -98,7 +98,7 @@ struct gw_node {
struct hlist_node list;
struct orig_node *orig_node;
unsigned long deleted;
- struct kref refcount;
+ atomic_t refcount;
struct rcu_head rcu;
};