aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-10-30 03:05:07 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-30 03:05:07 -0400
commit9eeebb5bc8d984298cba9d12690923cdc09ab173 (patch)
tree2917993c44af42e335533b1018b35c17b3747132
parent3ddb709af32bacaf78d124420404d1ac19be99b8 (diff)
parent93840ac40bb0d0f177ef8af74e64671be67e8c37 (diff)
Merge branch 'batman-adv/maint' of git://git.open-mesh.org/linux-merge
-rw-r--r--net/batman-adv/translation-table.c17
-rw-r--r--net/batman-adv/types.h4
2 files changed, 18 insertions, 3 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 873fb3d8e56f..c7aafc7c5ed4 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
137 kfree_rcu(tt_local_entry, rcu); 137 kfree_rcu(tt_local_entry, rcu);
138} 138}
139 139
140static void tt_global_entry_free_rcu(struct rcu_head *rcu)
141{
142 struct tt_global_entry *tt_global_entry;
143
144 tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
145
146 if (tt_global_entry->orig_node)
147 orig_node_free_ref(tt_global_entry->orig_node);
148
149 kfree(tt_global_entry);
150}
151
140static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) 152static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
141{ 153{
142 if (atomic_dec_and_test(&tt_global_entry->refcount)) 154 if (atomic_dec_and_test(&tt_global_entry->refcount))
143 kfree_rcu(tt_global_entry, rcu); 155 call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
144} 156}
145 157
146static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, 158static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
@@ -710,6 +722,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
710 struct hlist_head *head; 722 struct hlist_head *head;
711 spinlock_t *list_lock; /* protects write access to the hash lists */ 723 spinlock_t *list_lock; /* protects write access to the hash lists */
712 724
725 if (!hash)
726 return;
727
713 for (i = 0; i < hash->size; i++) { 728 for (i = 0; i < hash->size; i++) {
714 head = &hash->table[i]; 729 head = &hash->table[i];
715 list_lock = &hash->list_locks[i]; 730 list_lock = &hash->list_locks[i];
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 1ae355750511..ab8d0fe6df5a 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -224,22 +224,22 @@ struct socket_packet {
224 224
225struct tt_local_entry { 225struct tt_local_entry {
226 uint8_t addr[ETH_ALEN]; 226 uint8_t addr[ETH_ALEN];
227 struct hlist_node hash_entry;
227 unsigned long last_seen; 228 unsigned long last_seen;
228 uint16_t flags; 229 uint16_t flags;
229 atomic_t refcount; 230 atomic_t refcount;
230 struct rcu_head rcu; 231 struct rcu_head rcu;
231 struct hlist_node hash_entry;
232}; 232};
233 233
234struct tt_global_entry { 234struct tt_global_entry {
235 uint8_t addr[ETH_ALEN]; 235 uint8_t addr[ETH_ALEN];
236 struct hlist_node hash_entry; /* entry in the global table */
236 struct orig_node *orig_node; 237 struct orig_node *orig_node;
237 uint8_t ttvn; 238 uint8_t ttvn;
238 uint16_t flags; /* only TT_GLOBAL_ROAM is used */ 239 uint16_t flags; /* only TT_GLOBAL_ROAM is used */
239 unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ 240 unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
240 atomic_t refcount; 241 atomic_t refcount;
241 struct rcu_head rcu; 242 struct rcu_head rcu;
242 struct hlist_node hash_entry; /* entry in the global table */
243}; 243};
244 244
245struct tt_change_node { 245struct tt_change_node {