diff options
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index f775202552e5..74021365b8c8 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -370,52 +370,52 @@ err_path_alloc: | |||
370 | return err; | 370 | return err; |
371 | } | 371 | } |
372 | 372 | ||
373 | static void mesh_table_free_rcu(struct rcu_head *rcu) | ||
374 | { | ||
375 | struct mesh_table *tbl = container_of(rcu, struct mesh_table, rcu_head); | ||
376 | |||
377 | mesh_table_free(tbl, false); | ||
378 | } | ||
379 | |||
373 | void mesh_mpath_table_grow(void) | 380 | void mesh_mpath_table_grow(void) |
374 | { | 381 | { |
375 | struct mesh_table *oldtbl, *newtbl; | 382 | struct mesh_table *oldtbl, *newtbl; |
376 | 383 | ||
377 | rcu_read_lock(); | ||
378 | newtbl = mesh_table_alloc(rcu_dereference(mesh_paths)->size_order + 1); | ||
379 | if (!newtbl) | ||
380 | return; | ||
381 | write_lock_bh(&pathtbl_resize_lock); | 384 | write_lock_bh(&pathtbl_resize_lock); |
385 | newtbl = mesh_table_alloc(mesh_paths->size_order + 1); | ||
386 | if (!newtbl) | ||
387 | goto out; | ||
382 | oldtbl = mesh_paths; | 388 | oldtbl = mesh_paths; |
383 | if (mesh_table_grow(mesh_paths, newtbl) < 0) { | 389 | if (mesh_table_grow(mesh_paths, newtbl) < 0) { |
384 | rcu_read_unlock(); | ||
385 | __mesh_table_free(newtbl); | 390 | __mesh_table_free(newtbl); |
386 | write_unlock_bh(&pathtbl_resize_lock); | 391 | goto out; |
387 | return; | ||
388 | } | 392 | } |
389 | rcu_read_unlock(); | ||
390 | rcu_assign_pointer(mesh_paths, newtbl); | 393 | rcu_assign_pointer(mesh_paths, newtbl); |
391 | write_unlock_bh(&pathtbl_resize_lock); | ||
392 | 394 | ||
393 | synchronize_rcu(); | 395 | call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); |
394 | mesh_table_free(oldtbl, false); | 396 | |
397 | out: | ||
398 | write_unlock_bh(&pathtbl_resize_lock); | ||
395 | } | 399 | } |
396 | 400 | ||
397 | void mesh_mpp_table_grow(void) | 401 | void mesh_mpp_table_grow(void) |
398 | { | 402 | { |
399 | struct mesh_table *oldtbl, *newtbl; | 403 | struct mesh_table *oldtbl, *newtbl; |
400 | 404 | ||
401 | rcu_read_lock(); | ||
402 | newtbl = mesh_table_alloc(rcu_dereference(mpp_paths)->size_order + 1); | ||
403 | if (!newtbl) | ||
404 | return; | ||
405 | write_lock_bh(&pathtbl_resize_lock); | 405 | write_lock_bh(&pathtbl_resize_lock); |
406 | newtbl = mesh_table_alloc(mpp_paths->size_order + 1); | ||
407 | if (!newtbl) | ||
408 | goto out; | ||
406 | oldtbl = mpp_paths; | 409 | oldtbl = mpp_paths; |
407 | if (mesh_table_grow(mpp_paths, newtbl) < 0) { | 410 | if (mesh_table_grow(mpp_paths, newtbl) < 0) { |
408 | rcu_read_unlock(); | ||
409 | __mesh_table_free(newtbl); | 411 | __mesh_table_free(newtbl); |
410 | write_unlock_bh(&pathtbl_resize_lock); | 412 | goto out; |
411 | return; | ||
412 | } | 413 | } |
413 | rcu_read_unlock(); | ||
414 | rcu_assign_pointer(mpp_paths, newtbl); | 414 | rcu_assign_pointer(mpp_paths, newtbl); |
415 | write_unlock_bh(&pathtbl_resize_lock); | 415 | call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); |
416 | 416 | ||
417 | synchronize_rcu(); | 417 | out: |
418 | mesh_table_free(oldtbl, false); | 418 | write_unlock_bh(&pathtbl_resize_lock); |
419 | } | 419 | } |
420 | 420 | ||
421 | int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) | 421 | int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) |