aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2013-11-05 14:17:00 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:50:18 -0500
commitfc10302ef1d22ec559b94a22c3b6b1fc7180240e (patch)
tree9d2fab61bb897a48b84081e362dd0f628828f46b /net/mac80211/mesh_plink.c
parent05a23ae927d1eb0491064fddaa8b1531a84def6f (diff)
mac80211: consolidate rcu unlocks in plink frame rx
Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index c234ddbbf625..e70f49018853 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -757,40 +757,33 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
757 !rssi_threshold_check(sdata, sta)) { 757 !rssi_threshold_check(sdata, sta)) {
758 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n", 758 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n",
759 mgmt->sa); 759 mgmt->sa);
760 rcu_read_unlock(); 760 goto unlock_rcu;
761 return;
762 } 761 }
763 762
764 if (!sta) { 763 if (!sta) {
765 if (ftype != WLAN_SP_MESH_PEERING_OPEN) { 764 if (ftype != WLAN_SP_MESH_PEERING_OPEN) {
766 mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n"); 765 mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n");
767 rcu_read_unlock(); 766 goto unlock_rcu;
768 return;
769 } 767 }
770 /* ftype == WLAN_SP_MESH_PEERING_OPEN */ 768 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
771 if (!mesh_plink_free_count(sdata)) { 769 if (!mesh_plink_free_count(sdata)) {
772 mpl_dbg(sdata, "Mesh plink error: no more free plinks\n"); 770 mpl_dbg(sdata, "Mesh plink error: no more free plinks\n");
773 rcu_read_unlock(); 771 goto unlock_rcu;
774 return;
775 } 772 }
776 /* deny open request from non-matching peer */ 773 /* deny open request from non-matching peer */
777 if (!matches_local) { 774 if (!matches_local) {
778 rcu_read_unlock();
779 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, 775 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
780 mgmt->sa, 0, plid, 776 mgmt->sa, 0, plid,
781 cpu_to_le16(WLAN_REASON_MESH_CONFIG)); 777 cpu_to_le16(WLAN_REASON_MESH_CONFIG));
782 return; 778 goto unlock_rcu;
783 } 779 }
784 } else { 780 } else {
785 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { 781 if (!test_sta_flag(sta, WLAN_STA_AUTH)) {
786 mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n"); 782 mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n");
787 rcu_read_unlock(); 783 goto unlock_rcu;
788 return;
789 }
790 if (sta->plink_state == NL80211_PLINK_BLOCKED) {
791 rcu_read_unlock();
792 return;
793 } 784 }
785 if (sta->plink_state == NL80211_PLINK_BLOCKED)
786 goto unlock_rcu;
794 } 787 }
795 788
796 /* Now we will figure out the appropriate event... */ 789 /* Now we will figure out the appropriate event... */
@@ -839,8 +832,7 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
839 break; 832 break;
840 default: 833 default:
841 mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n"); 834 mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n");
842 rcu_read_unlock(); 835 goto unlock_rcu;
843 return;
844 } 836 }
845 } 837 }
846 838
@@ -850,8 +842,7 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
850 sta = mesh_sta_info_get(sdata, mgmt->sa, elems); 842 sta = mesh_sta_info_get(sdata, mgmt->sa, elems);
851 if (!sta) { 843 if (!sta) {
852 mpl_dbg(sdata, "Mesh plink: failed to init peer!\n"); 844 mpl_dbg(sdata, "Mesh plink: failed to init peer!\n");
853 rcu_read_unlock(); 845 goto unlock_rcu;
854 return;
855 } 846 }
856 } 847 }
857 848
@@ -998,6 +989,7 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
998 } 989 }
999 } 990 }
1000 991
992unlock_rcu:
1001 rcu_read_unlock(); 993 rcu_read_unlock();
1002 994
1003 if (changed) 995 if (changed)