diff options
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r-- | net/mac80211/mesh.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 697ef67f96b6..ca81d0065eb8 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -349,7 +349,7 @@ struct mesh_table *mesh_table_grow(struct mesh_table *tbl) | |||
349 | { | 349 | { |
350 | struct mesh_table *newtbl; | 350 | struct mesh_table *newtbl; |
351 | struct hlist_head *oldhash; | 351 | struct hlist_head *oldhash; |
352 | struct hlist_node *p; | 352 | struct hlist_node *p, *q; |
353 | int err = 0; | 353 | int err = 0; |
354 | int i; | 354 | int i; |
355 | 355 | ||
@@ -373,13 +373,24 @@ struct mesh_table *mesh_table_grow(struct mesh_table *tbl) | |||
373 | oldhash = tbl->hash_buckets; | 373 | oldhash = tbl->hash_buckets; |
374 | for (i = 0; i <= tbl->hash_mask; i++) | 374 | for (i = 0; i <= tbl->hash_mask; i++) |
375 | hlist_for_each(p, &oldhash[i]) | 375 | hlist_for_each(p, &oldhash[i]) |
376 | tbl->copy_node(p, newtbl); | 376 | if (tbl->copy_node(p, newtbl) < 0) |
377 | goto errcopy; | ||
377 | 378 | ||
378 | endgrow: | 379 | endgrow: |
379 | if (err) | 380 | if (err) |
380 | return NULL; | 381 | return NULL; |
381 | else | 382 | else |
382 | return newtbl; | 383 | return newtbl; |
384 | |||
385 | errcopy: | ||
386 | for (i = 0; i <= newtbl->hash_mask; i++) { | ||
387 | hlist_for_each_safe(p, q, &newtbl->hash_buckets[i]) | ||
388 | tbl->free_node(p, 0); | ||
389 | } | ||
390 | kfree(newtbl->hash_buckets); | ||
391 | kfree(newtbl->hashwlock); | ||
392 | kfree(newtbl); | ||
393 | return NULL; | ||
383 | } | 394 | } |
384 | 395 | ||
385 | /** | 396 | /** |