Commit 0f5ffd24fb732fb4d653a8ee97faea767a0e7172
Committed by
Johannes Berg
1 parent
4efec45134
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
mac80211: hold sta->lock across plink switch statements
Rather than unlock at the end of each case, do it once after all is said and done. Signed-off-by: Bob Copeland <bob@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Showing 1 changed file with 3 additions and 26 deletions Side-by-side Diff
net/mac80211/mesh_plink.c
... | ... | @@ -575,7 +575,6 @@ |
575 | 575 | rand % sta->plink_timeout; |
576 | 576 | ++sta->plink_retries; |
577 | 577 | mod_plink_timer(sta, sta->plink_timeout); |
578 | - spin_unlock_bh(&sta->lock); | |
579 | 578 | action = WLAN_SP_MESH_PEERING_OPEN; |
580 | 579 | break; |
581 | 580 | } |
582 | 581 | |
583 | 582 | |
584 | 583 | |
... | ... | @@ -587,19 +586,17 @@ |
587 | 586 | reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT); |
588 | 587 | sta->plink_state = NL80211_PLINK_HOLDING; |
589 | 588 | mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); |
590 | - spin_unlock_bh(&sta->lock); | |
591 | 589 | action = WLAN_SP_MESH_PEERING_CLOSE; |
592 | 590 | break; |
593 | 591 | case NL80211_PLINK_HOLDING: |
594 | 592 | /* holding timer */ |
595 | 593 | del_timer(&sta->plink_timer); |
596 | 594 | mesh_plink_fsm_restart(sta); |
597 | - spin_unlock_bh(&sta->lock); | |
598 | 595 | break; |
599 | 596 | default: |
600 | - spin_unlock_bh(&sta->lock); | |
601 | 597 | break; |
602 | 598 | } |
599 | + spin_unlock_bh(&sta->lock); | |
603 | 600 | if (action) |
604 | 601 | mesh_plink_frame_tx(sdata, action, sta->sta.addr, |
605 | 602 | llid, plid, reason); |
606 | 603 | |
... | ... | @@ -856,12 +853,10 @@ |
856 | 853 | reason = 0; |
857 | 854 | spin_lock_bh(&sta->lock); |
858 | 855 | switch (sta->plink_state) { |
859 | - /* spin_unlock as soon as state is updated at each case */ | |
860 | 856 | case NL80211_PLINK_LISTEN: |
861 | 857 | switch (event) { |
862 | 858 | case CLS_ACPT: |
863 | 859 | mesh_plink_fsm_restart(sta); |
864 | - spin_unlock_bh(&sta->lock); | |
865 | 860 | break; |
866 | 861 | case OPN_ACPT: |
867 | 862 | sta->plink_state = NL80211_PLINK_OPN_RCVD; |
868 | 863 | |
... | ... | @@ -874,11 +869,9 @@ |
874 | 869 | /* set the non-peer mode to active during peering */ |
875 | 870 | changed |= ieee80211_mps_local_status_update(sdata); |
876 | 871 | |
877 | - spin_unlock_bh(&sta->lock); | |
878 | 872 | action = WLAN_SP_MESH_PEERING_OPEN; |
879 | 873 | break; |
880 | 874 | default: |
881 | - spin_unlock_bh(&sta->lock); | |
882 | 875 | break; |
883 | 876 | } |
884 | 877 | break; |
885 | 878 | |
... | ... | @@ -897,14 +890,12 @@ |
897 | 890 | mshcfg->dot11MeshHoldingTimeout)) |
898 | 891 | sta->ignore_plink_timer = true; |
899 | 892 | |
900 | - spin_unlock_bh(&sta->lock); | |
901 | 893 | action = WLAN_SP_MESH_PEERING_CLOSE; |
902 | 894 | break; |
903 | 895 | case OPN_ACPT: |
904 | 896 | /* retry timer is left untouched */ |
905 | 897 | sta->plink_state = NL80211_PLINK_OPN_RCVD; |
906 | 898 | sta->plid = plid; |
907 | - spin_unlock_bh(&sta->lock); | |
908 | 899 | action = WLAN_SP_MESH_PEERING_CONFIRM; |
909 | 900 | break; |
910 | 901 | case CNF_ACPT: |
911 | 902 | |
... | ... | @@ -913,10 +904,8 @@ |
913 | 904 | mshcfg->dot11MeshConfirmTimeout)) |
914 | 905 | sta->ignore_plink_timer = true; |
915 | 906 | |
916 | - spin_unlock_bh(&sta->lock); | |
917 | 907 | break; |
918 | 908 | default: |
919 | - spin_unlock_bh(&sta->lock); | |
920 | 909 | break; |
921 | 910 | } |
922 | 911 | break; |
923 | 912 | |
924 | 913 | |
... | ... | @@ -935,17 +924,14 @@ |
935 | 924 | mshcfg->dot11MeshHoldingTimeout)) |
936 | 925 | sta->ignore_plink_timer = true; |
937 | 926 | |
938 | - spin_unlock_bh(&sta->lock); | |
939 | 927 | action = WLAN_SP_MESH_PEERING_CLOSE; |
940 | 928 | break; |
941 | 929 | case OPN_ACPT: |
942 | - spin_unlock_bh(&sta->lock); | |
943 | 930 | action = WLAN_SP_MESH_PEERING_CONFIRM; |
944 | 931 | break; |
945 | 932 | case CNF_ACPT: |
946 | 933 | del_timer(&sta->plink_timer); |
947 | 934 | sta->plink_state = NL80211_PLINK_ESTAB; |
948 | - spin_unlock_bh(&sta->lock); | |
949 | 935 | changed |= mesh_plink_inc_estab_count(sdata); |
950 | 936 | changed |= mesh_set_ht_prot_mode(sdata); |
951 | 937 | changed |= mesh_set_short_slot_time(sdata); |
... | ... | @@ -956,7 +942,6 @@ |
956 | 942 | mshcfg->power_mode); |
957 | 943 | break; |
958 | 944 | default: |
959 | - spin_unlock_bh(&sta->lock); | |
960 | 945 | break; |
961 | 946 | } |
962 | 947 | break; |
963 | 948 | |
... | ... | @@ -975,13 +960,11 @@ |
975 | 960 | mshcfg->dot11MeshHoldingTimeout)) |
976 | 961 | sta->ignore_plink_timer = true; |
977 | 962 | |
978 | - spin_unlock_bh(&sta->lock); | |
979 | 963 | action = WLAN_SP_MESH_PEERING_CLOSE; |
980 | 964 | break; |
981 | 965 | case OPN_ACPT: |
982 | 966 | del_timer(&sta->plink_timer); |
983 | 967 | sta->plink_state = NL80211_PLINK_ESTAB; |
984 | - spin_unlock_bh(&sta->lock); | |
985 | 968 | changed |= mesh_plink_inc_estab_count(sdata); |
986 | 969 | changed |= mesh_set_ht_prot_mode(sdata); |
987 | 970 | changed |= mesh_set_short_slot_time(sdata); |
... | ... | @@ -993,7 +976,6 @@ |
993 | 976 | mshcfg->power_mode); |
994 | 977 | break; |
995 | 978 | default: |
996 | - spin_unlock_bh(&sta->lock); | |
997 | 979 | break; |
998 | 980 | } |
999 | 981 | break; |
1000 | 982 | |
1001 | 983 | |
... | ... | @@ -1006,17 +988,14 @@ |
1006 | 988 | changed |= __mesh_plink_deactivate(sta); |
1007 | 989 | sta->plink_state = NL80211_PLINK_HOLDING; |
1008 | 990 | mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); |
1009 | - spin_unlock_bh(&sta->lock); | |
1010 | 991 | changed |= mesh_set_ht_prot_mode(sdata); |
1011 | 992 | changed |= mesh_set_short_slot_time(sdata); |
1012 | 993 | action = WLAN_SP_MESH_PEERING_CLOSE; |
1013 | 994 | break; |
1014 | 995 | case OPN_ACPT: |
1015 | - spin_unlock_bh(&sta->lock); | |
1016 | 996 | action = WLAN_SP_MESH_PEERING_CONFIRM; |
1017 | 997 | break; |
1018 | 998 | default: |
1019 | - spin_unlock_bh(&sta->lock); | |
1020 | 999 | break; |
1021 | 1000 | } |
1022 | 1001 | break; |
1023 | 1002 | |
1024 | 1003 | |
1025 | 1004 | |
1026 | 1005 | |
... | ... | @@ -1026,26 +1005,24 @@ |
1026 | 1005 | if (del_timer(&sta->plink_timer)) |
1027 | 1006 | sta->ignore_plink_timer = 1; |
1028 | 1007 | mesh_plink_fsm_restart(sta); |
1029 | - spin_unlock_bh(&sta->lock); | |
1030 | 1008 | break; |
1031 | 1009 | case OPN_ACPT: |
1032 | 1010 | case CNF_ACPT: |
1033 | 1011 | case OPN_RJCT: |
1034 | 1012 | case CNF_RJCT: |
1035 | - spin_unlock_bh(&sta->lock); | |
1036 | 1013 | action = WLAN_SP_MESH_PEERING_CLOSE; |
1037 | 1014 | break; |
1038 | 1015 | default: |
1039 | - spin_unlock_bh(&sta->lock); | |
1016 | + break; | |
1040 | 1017 | } |
1041 | 1018 | break; |
1042 | 1019 | default: |
1043 | 1020 | /* should not get here, PLINK_BLOCKED is dealt with at the |
1044 | 1021 | * beginning of the function |
1045 | 1022 | */ |
1046 | - spin_unlock_bh(&sta->lock); | |
1047 | 1023 | break; |
1048 | 1024 | } |
1025 | + spin_unlock_bh(&sta->lock); | |
1049 | 1026 | if (action) { |
1050 | 1027 | mesh_plink_frame_tx(sdata, action, sta->sta.addr, |
1051 | 1028 | sta->llid, sta->plid, sta->reason); |