Skip to content

Commit 6b04716

Browse files
committed
wifi: mac80211: don't complete management TX on SAE commit
When SAE commit is sent and received in response, there's no ordering for the SAE confirm messages. As such, don't call drivers to stop listening on the channel when the confirm message is still expected. This fixes an issue if the local confirm is transmitted later than the AP's confirm, for iwlwifi (and possibly mt76) the AP's confirm would then get lost since the device isn't on the channel at the time the AP transmit the confirm. For iwlwifi at least, this also improves the overall timing of the authentication handshake (by about 15ms according to the report), likely since the session protection won't be aborted and rescheduled. Note that even before this, mgd_complete_tx() wasn't always called for each call to mgd_prepare_tx() (e.g. in the case of WEP key shared authentication), and the current drivers that have the complete callback don't seem to mind. Document this as well though. Reported-by: Jan Hendrik Farr <kernel@jfarr.cc> Closes: https://lore.kernel.org/all/aB30Ea2kRG24LINR@archlinux/ Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250609213232.12691580e140.I3f1d3127acabcd58348a110ab11044213cf147d3@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a11ec0d commit 6b04716

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/net/mac80211.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,6 +4310,8 @@ struct ieee80211_prep_tx_info {
43104310
* @mgd_complete_tx: Notify the driver that the response frame for a previously
43114311
* transmitted frame announced with @mgd_prepare_tx was received, the data
43124312
* is filled similarly to @mgd_prepare_tx though the duration is not used.
4313+
* Note that this isn't always called for each mgd_prepare_tx() call, for
4314+
* example for SAE the 'confirm' messages can be on the air in any order.
43134315
*
43144316
* @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
43154317
* a TDLS discovery-request, we expect a reply to arrive on the AP's

net/mac80211/mlme.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4780,6 +4780,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
47804780
struct ieee80211_prep_tx_info info = {
47814781
.subtype = IEEE80211_STYPE_AUTH,
47824782
};
4783+
bool sae_need_confirm = false;
47834784

47844785
lockdep_assert_wiphy(sdata->local->hw.wiphy);
47854786

@@ -4825,6 +4826,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
48254826
jiffies + IEEE80211_AUTH_WAIT_SAE_RETRY;
48264827
ifmgd->auth_data->timeout_started = true;
48274828
run_again(sdata, ifmgd->auth_data->timeout);
4829+
if (auth_transaction == 1)
4830+
sae_need_confirm = true;
48284831
goto notify_driver;
48294832
}
48304833

@@ -4867,6 +4870,9 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
48674870
ifmgd->auth_data->expected_transaction == 2)) {
48684871
if (!ieee80211_mark_sta_auth(sdata))
48694872
return; /* ignore frame -- wait for timeout */
4873+
} else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE &&
4874+
auth_transaction == 1) {
4875+
sae_need_confirm = true;
48704876
} else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE &&
48714877
auth_transaction == 2) {
48724878
sdata_info(sdata, "SAE peer confirmed\n");
@@ -4875,7 +4881,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
48754881

48764882
cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
48774883
notify_driver:
4878-
drv_mgd_complete_tx(sdata->local, sdata, &info);
4884+
if (!sae_need_confirm)
4885+
drv_mgd_complete_tx(sdata->local, sdata, &info);
48794886
}
48804887

48814888
#define case_WLAN(type) \

0 commit comments

Comments
 (0)