summaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2018-10-10 17:21:20 -0400
committerJohannes Berg <johannes.berg@intel.com>2018-10-11 10:01:07 -0400
commit8d7432a2f53bc283148062955cbe7ffbf713e646 (patch)
tree06432be630d4760f823c9fd6375539aa93822c84 /net/mac80211/mlme.c
parentfc107a93307165d5bf966767e4456832ef3940ef (diff)
mac80211: Move ieee80211_mgd_auth() EBUSY check to be before allocation
This makes it easier to conditionally replace full allocation of auth_data to use reallocation for the case of continuing SAE authentication. Furthermore, there was not really any point in having this check done so late in the function after having already completed number of steps that cannot be used anyway in the error case. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d3ec0156780..1818dbc5622d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4922,6 +4922,10 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
4922 return -EOPNOTSUPP; 4922 return -EOPNOTSUPP;
4923 } 4923 }
4924 4924
4925 if ((ifmgd->auth_data && !ifmgd->auth_data->done) ||
4926 ifmgd->assoc_data)
4927 return -EBUSY;
4928
4925 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + 4929 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
4926 req->ie_len, GFP_KERNEL); 4930 req->ie_len, GFP_KERNEL);
4927 if (!auth_data) 4931 if (!auth_data)
@@ -4957,12 +4961,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
4957 4961
4958 /* try to authenticate/probe */ 4962 /* try to authenticate/probe */
4959 4963
4960 if ((ifmgd->auth_data && !ifmgd->auth_data->done) ||
4961 ifmgd->assoc_data) {
4962 err = -EBUSY;
4963 goto err_free;
4964 }
4965
4966 if (ifmgd->auth_data) 4964 if (ifmgd->auth_data)
4967 ieee80211_destroy_auth_data(sdata, false); 4965 ieee80211_destroy_auth_data(sdata, false);
4968 4966
@@ -5007,7 +5005,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
5007 mutex_lock(&sdata->local->mtx); 5005 mutex_lock(&sdata->local->mtx);
5008 ieee80211_vif_release_channel(sdata); 5006 ieee80211_vif_release_channel(sdata);
5009 mutex_unlock(&sdata->local->mtx); 5007 mutex_unlock(&sdata->local->mtx);
5010 err_free:
5011 kfree(auth_data); 5008 kfree(auth_data);
5012 return err; 5009 return err;
5013} 5010}