aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2012-03-06 19:42:09 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-07 13:56:36 -0500
commitf06c7885c3dd3db8eb771e10615ee41425607e95 (patch)
tree19fafdc2191f6783ff309befa005d292363ad2fe /net
parentb443d8d8a2b4c3def4b47c17a44bb17ea0a3202f (diff)
mac80211: fix smatch lock errors in mesh
smatch was complaining: CHECK net/mac80211/mesh_pathtbl.c net/mac80211/mesh_pathtbl.c:562 mesh_path_add() error: double lock 'bottom_half:' net/mac80211/mesh_pathtbl.c:580 mesh_path_add() error: double unlock 'bottom_half:' net/mac80211/mesh_pathtbl.c:589 mesh_path_add() error: double unlock 'bottom_half:' net/mac80211/mesh_pathtbl.c:691 mpp_path_add() error: double lock 'bottom_half:' net/mac80211/mesh_pathtbl.c:707 mpp_path_add() error: double unlock 'bottom_half:' net/mac80211/mesh_pathtbl.c:716 mpp_path_add() error: double unlock 'bottom_half:' net/mac80211/mesh_pathtbl.c:814 mesh_path_flush_by_nexthop() error: double lock 'bottom_half:' net/mac80211/mesh_pathtbl.c:819 mesh_path_flush_by_nexthop() error: double unlock 'bottom_half:' net/mac80211/mesh_pathtbl.c:887 mesh_path_del() error: double lock 'bottom_half:' net/mac80211/mesh_pathtbl.c:901 mesh_path_del() error: double unlock 'bottom_half:' So don't lock / unlock with _bh() while bottom halves are already disabled. Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mesh_pathtbl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 157642f780b9..be1361b5f7ad 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -559,7 +559,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
559 hash_idx = mesh_table_hash(dst, sdata, tbl); 559 hash_idx = mesh_table_hash(dst, sdata, tbl);
560 bucket = &tbl->hash_buckets[hash_idx]; 560 bucket = &tbl->hash_buckets[hash_idx];
561 561
562 spin_lock_bh(&tbl->hashwlock[hash_idx]); 562 spin_lock(&tbl->hashwlock[hash_idx]);
563 563
564 err = -EEXIST; 564 err = -EEXIST;
565 hlist_for_each_entry(node, n, bucket, list) { 565 hlist_for_each_entry(node, n, bucket, list) {
@@ -576,7 +576,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
576 576
577 mesh_paths_generation++; 577 mesh_paths_generation++;
578 578
579 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 579 spin_unlock(&tbl->hashwlock[hash_idx]);
580 read_unlock_bh(&pathtbl_resize_lock); 580 read_unlock_bh(&pathtbl_resize_lock);
581 if (grow) { 581 if (grow) {
582 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags); 582 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags);
@@ -585,7 +585,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
585 return 0; 585 return 0;
586 586
587err_exists: 587err_exists:
588 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 588 spin_unlock(&tbl->hashwlock[hash_idx]);
589 read_unlock_bh(&pathtbl_resize_lock); 589 read_unlock_bh(&pathtbl_resize_lock);
590 kfree(new_node); 590 kfree(new_node);
591err_node_alloc: 591err_node_alloc:
@@ -688,7 +688,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
688 hash_idx = mesh_table_hash(dst, sdata, tbl); 688 hash_idx = mesh_table_hash(dst, sdata, tbl);
689 bucket = &tbl->hash_buckets[hash_idx]; 689 bucket = &tbl->hash_buckets[hash_idx];
690 690
691 spin_lock_bh(&tbl->hashwlock[hash_idx]); 691 spin_lock(&tbl->hashwlock[hash_idx]);
692 692
693 err = -EEXIST; 693 err = -EEXIST;
694 hlist_for_each_entry(node, n, bucket, list) { 694 hlist_for_each_entry(node, n, bucket, list) {
@@ -703,7 +703,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
703 tbl->mean_chain_len * (tbl->hash_mask + 1)) 703 tbl->mean_chain_len * (tbl->hash_mask + 1))
704 grow = 1; 704 grow = 1;
705 705
706 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 706 spin_unlock(&tbl->hashwlock[hash_idx]);
707 read_unlock_bh(&pathtbl_resize_lock); 707 read_unlock_bh(&pathtbl_resize_lock);
708 if (grow) { 708 if (grow) {
709 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags); 709 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags);
@@ -712,7 +712,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
712 return 0; 712 return 0;
713 713
714err_exists: 714err_exists:
715 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 715 spin_unlock(&tbl->hashwlock[hash_idx]);
716 read_unlock_bh(&pathtbl_resize_lock); 716 read_unlock_bh(&pathtbl_resize_lock);
717 kfree(new_node); 717 kfree(new_node);
718err_node_alloc: 718err_node_alloc:
@@ -811,9 +811,9 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
811 for_each_mesh_entry(tbl, p, node, i) { 811 for_each_mesh_entry(tbl, p, node, i) {
812 mpath = node->mpath; 812 mpath = node->mpath;
813 if (rcu_dereference(mpath->next_hop) == sta) { 813 if (rcu_dereference(mpath->next_hop) == sta) {
814 spin_lock_bh(&tbl->hashwlock[i]); 814 spin_lock(&tbl->hashwlock[i]);
815 __mesh_path_del(tbl, node); 815 __mesh_path_del(tbl, node);
816 spin_unlock_bh(&tbl->hashwlock[i]); 816 spin_unlock(&tbl->hashwlock[i]);
817 } 817 }
818 } 818 }
819 read_unlock_bh(&pathtbl_resize_lock); 819 read_unlock_bh(&pathtbl_resize_lock);
@@ -884,7 +884,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
884 hash_idx = mesh_table_hash(addr, sdata, tbl); 884 hash_idx = mesh_table_hash(addr, sdata, tbl);
885 bucket = &tbl->hash_buckets[hash_idx]; 885 bucket = &tbl->hash_buckets[hash_idx];
886 886
887 spin_lock_bh(&tbl->hashwlock[hash_idx]); 887 spin_lock(&tbl->hashwlock[hash_idx]);
888 hlist_for_each_entry(node, n, bucket, list) { 888 hlist_for_each_entry(node, n, bucket, list) {
889 mpath = node->mpath; 889 mpath = node->mpath;
890 if (mpath->sdata == sdata && 890 if (mpath->sdata == sdata &&
@@ -897,7 +897,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
897 err = -ENXIO; 897 err = -ENXIO;
898enddel: 898enddel:
899 mesh_paths_generation++; 899 mesh_paths_generation++;
900 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 900 spin_unlock(&tbl->hashwlock[hash_idx]);
901 read_unlock_bh(&pathtbl_resize_lock); 901 read_unlock_bh(&pathtbl_resize_lock);
902 return err; 902 return err;
903} 903}