git: c6e70c68d2ce - main - LinuxKPI: 802.11: lkpi_80211_txq_tx_one() only pass sta if added to drv

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 13 Jul 2026 14:59:22 UTC
The branch main has been updated by bz:

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

commit c6e70c68d2ce5cfbcace251ef6ed2f1eae912a74
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-07-11 13:35:31 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-07-13 14:58:24 +0000

    LinuxKPI: 802.11: lkpi_80211_txq_tx_one() only pass sta if added to drv
    
    If we are doing a direct (*tx) downcall, only pass sta as meta data
    if it was added to the driver (via the state machine).  This prevents
    us passing a sta not known to the driver leading to possible follow-up
    complications/errors.  This will usually happen if (a) we are doing
    software scanning, or (b) if net80211 decides to change the ni from
    under us and sends a packet with the new ni.
    
    Adjust a debug statement before to also have the added_to_drv field
    in it to ease debugging.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 2e7ce4d4148f..ffce2fe48e10 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -6224,13 +6224,14 @@ lkpi_80211_txq_tx_one(struct lkpi_sta *lsta, struct mbuf *m)
 ops_tx:
 #ifdef LINUXKPI_DEBUG_80211
 	if (linuxkpi_debug_80211 & D80211_TRACE_TX)
-		printf("%s:%d mo_tx :: lsta %p sta %p ni %p %6D skb %p "
-		    "TX ac %d prio %u qmap %u\n",
-		    __func__, __LINE__, lsta, sta, ni, ni->ni_macaddr, ":",
-		    skb, ac, skb->priority, skb->qmap);
+		printf("%s:%d mo_tx :: lsta %p { added_to_drv %d } sta %p "
+		    "ni %p %6D skb %p TX ac %d prio %u qmap %u\n",
+		    __func__, __LINE__, lsta, lsta->added_to_drv, sta,
+		    ni, ni->ni_macaddr, ":", skb, ac, skb->priority, skb->qmap);
 #endif
 	memset(&control, 0, sizeof(control));
-	control.sta = sta;
+	if (lsta->added_to_drv)
+		control.sta = sta;
 	wiphy_lock(hw->wiphy);
 	lkpi_80211_mo_tx(hw, &control, skb);
 	lsta->frms_tx++;