Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2025 19:14:42 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 36174c38f9e3 - releng/14.3 - LinuxKPI: 802.11: make sure AUTH frames are not being sent if BSS changed
Message-ID:  <202505151914.54FJEg2s002674@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/14.3 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=36174c38f9e3433e7fdb8b2f2923499dff67b2e7

commit 36174c38f9e3433e7fdb8b2f2923499dff67b2e7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-05-12 15:12:39 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-05-15 19:13:58 +0000

    LinuxKPI: 802.11: make sure AUTH frames are not being sent if BSS changed
    
    iwlwifi keeps logging 'Invalid TXQ id' even after previous changes to
    catch the BSS changed.  The reason for this is that we do not error in
    the SCAN -> AUTH path as otherwise we would not have the state machine
    get us back to SCAN to clear up firmware state before auth/assoc to the
    new BSS.
    
    If we are not in synch as net80211 just swapped the iv_bss from under us,
    disable the TX queue for the (old) lsta to prevent the AUTH frame sent
    from sta_newstate() reaching the driver.  After all we are not trying to
    authenticate to that node (sta) anymore.
    
    Sponsored by:   The FreeBSD Foundation
    PR:             274382
    Approved by:    re (cperciva)
    
    (cherry picked from commit 16d987fe781780100a31df30b9edd79ebb54f957)
    (cherry picked from commit e0692e7bb6e8abcc55a2510dceea5f83e823a827)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index fb9a4bc0177b..82eaa64790b4 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2021,6 +2021,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 	struct ieee80211_prep_tx_info prep_tx_info;
 	uint32_t changed;
 	int error;
+	bool synched;
 
 	/*
 	 * In here we use vap->iv_bss until lvif->lvif_bss is set.
@@ -2211,14 +2212,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 	    __func__, ni, ni->ni_drv_data));
 	lsta = ni->ni_drv_data;
 
-	/*
-	 * Make sure in case the sta did not change and we re-add it,
-	 * that we can tx again.
-	 */
-	LKPI_80211_LSTA_TXQ_LOCK(lsta);
-	lsta->txq_ready = true;
-	LKPI_80211_LSTA_TXQ_UNLOCK(lsta);
-
 	/* Insert the [l]sta into the list of known stations. */
 	list_add_tail(&lsta->lsta_list, &lvif->lsta_list);
 
@@ -2292,10 +2285,10 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 	ieee80211_ref_node(lsta->ni);
 	lvif->lvif_bss = lsta;
 	if (lsta->ni == vap->iv_bss) {
-		lvif->lvif_bss_synched = true;
+		lvif->lvif_bss_synched = synched = true;
 	} else {
 		/* Set to un-synched no matter what. */
-		lvif->lvif_bss_synched = false;
+		lvif->lvif_bss_synched = synched = false;
 		/*
 		 * We do not error as someone has to take us down.
 		 * If we are followed by a 2nd, new net80211::join1() going to
@@ -2305,9 +2298,20 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 		 * to net80211 as we never used the node beyond alloc()/free()
 		 * and we do not hold an extra reference for that anymore given
 		 * ni : lsta == 1:1.
+		 * Problem is if we do not error a MGMT/AUTH frame will be
+		 * sent from net80211::sta_newstate(); disable lsta queue below.
 		 */
 	}
 	LKPI_80211_LVIF_UNLOCK(lvif);
+	/*
+	 * Make sure in case the sta did not change and we re-added it,
+	 * that we can tx again but only if the vif/iv_bss are in sync.
+	 * Otherwise this should prevent the MGMT/AUTH frame from being
+	 * sent triggering a warning in iwlwifi.
+	 */
+	LKPI_80211_LSTA_TXQ_LOCK(lsta);
+	lsta->txq_ready = synched;
+	LKPI_80211_LSTA_TXQ_UNLOCK(lsta);
 	goto out_relocked;
 
 out:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505151914.54FJEg2s002674>