Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33483a6b authored by Wei Yongjun's avatar Wei Yongjun Committed by Johannes Berg
Browse files

mac80211: fix missing unlock on error in ieee80211_mark_sta_auth()



Add the missing unlock before return from function
ieee80211_mark_sta_auth() in the error handling case.

Cc: stable@vger.kernel.org
Fixes: fc107a93 ("mac80211: Helper function for marking STA authenticated")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
[use result variable/label instead of duplicating]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 05cc09de
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -2766,6 +2766,7 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata,
{
	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
	struct sta_info *sta;
	bool result = true;

	sdata_info(sdata, "authenticated\n");
	ifmgd->auth_data->done = true;
@@ -2778,15 +2779,18 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata,
	sta = sta_info_get(sdata, bssid);
	if (!sta) {
		WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
		return false;
		result = false;
		goto out;
	}
	if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
		sdata_info(sdata, "failed moving %pM to auth\n", bssid);
		return false;
		result = false;
		goto out;
	}
	mutex_unlock(&sdata->local->sta_mtx);

	return true;
out:
	mutex_unlock(&sdata->local->sta_mtx);
	return result;
}

static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,