From nobody Fri Jan 16 19:40:43 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dt9F74P7Vz6NlD7 for ; Fri, 16 Jan 2026 19:40:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dt9F70hcmz3x5x for ; Fri, 16 Jan 2026 19:40:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nEcZs2Ej70dIkIlqL1cHjU8zfFibeEFb4q4KpPMiF4E=; b=mGjj66R9RpnbP1WT+oFIycGtl5+Tv9r/Ja9QWbtpt/F0SFCqRR6EWfONVHuUMnxwk8/kjm qTkCXDf/02O8O1iPxskf8GDZQdPZoRtqw68d5StCn8w0ZgOixYqS7vugcsoaSaEX+/NkZW va1x5RSjCV6VfD2m9tpc9aU+y7YXWRF79t3MaBsXDg4irpCoNFCxkOPH2qLH8esHlCV/at Mhl3WKDMI65eesTuZRyaSHWGi7s7pr6FZT61u36xs81xIN6388s0GyRkcwz/lyswXG41Db qhEmAicMAx8JqZ1Nu4iqw97ZUxxPmduMpzpC9eG2EVymjRd3hLcN6I0zB8Bdsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nEcZs2Ej70dIkIlqL1cHjU8zfFibeEFb4q4KpPMiF4E=; b=ULZI4Sa5BvFFh+tyizbzKnuL9+REwx0NiuRleOgcz9dEb/+bcxKBzYn9FBiMo7I2dAj2yy EgE6VTtTGOpbR+WoETA+TRACj5uNzsrX7OEqwCnT4mFfogF/a7M9fHibiFwFXI6Rj8YQ4t URX1Gpaib0T/LexT+MAGel/+wnsnHboQYAW4dUg5xW9/kmefR5X4FpwHPCHlT+IVZR/Y9W LpXbVV6vPxM9+WRp/rTO2o10a+dkQlorhhfIUea9QAHH/VlHCtyjKOXaOCB0eFr1SIOVHm a/JX8QHIjdvcM6/vCn8blZSWxr0VBv95hyn4hIh/3YMR18Hggp3j7o/ZugSWhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768592443; a=rsa-sha256; cv=none; b=petDGZ6eRZTvdXCR9Q29euksboka032FGgjvmpDi9Uwpt6oJWWgu9aLNkZaJ9xcoTj/Awp nxrQ40fHZ4sRir1iQMZs+d06diMGEsIb5F3XCzxG0TgL7qPmq3X8rUfSGatqYHmf1mOTQE z9AG+qjVho3+DfXSHm3ya0Ii+Hko5EYwSuC2mDksJsYMzYVbNdFNTS+pC1XJnpU+joWfIi mXgYzJ/smATVpoUb7hE2ZMxjv7Xdgl7q0fHGKlzDk/6Wkne9mUXVY7g5KzPghnWF+xTNK4 y/WF0KLYSFmIR2uqM60W5JeuFA+tNVgQfApb3Y03R7QeugVLeQYZTY5XMsFRjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dt9F708YdzBr5 for ; Fri, 16 Jan 2026 19:40:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id dbd7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 19:40:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 4a26d2750b56 - stable/14 - LinuxKPI: 802.11: do not delete keys while still assoc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4a26d2750b5695a1e700ea1530628e7ad470baaa Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 19:40:43 +0000 Message-Id: <696a943b.dbd7.76f20e42@gitrepo.freebsd.org> The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4a26d2750b5695a1e700ea1530628e7ad470baaa commit 4a26d2750b5695a1e700ea1530628e7ad470baaa Author: Bjoern A. Zeeb AuthorDate: 2025-05-24 20:09:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-16 19:37:45 +0000 LinuxKPI: 802.11: do not delete keys while still assoc While we are still associated we cannot delete the keys as packets may still go out and if the firmware has no more keys it will raise and exception. This can happen given net80211 has its own mind when to do this and we, in various places, unlock and re-lock the com lock, so are open to races. Sponsored by: The FreeBSD Foundation (cherry picked from commit 86a0941db7028a5eb4d56aaa34998b833e5de174) --- sys/compat/linuxkpi/common/src/linux_80211.c | 40 +++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 17279f3caf6c..caa98f884e8b 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1319,6 +1319,7 @@ lkpi_iv_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) lhw = ic->ic_softc; hw = LHW_TO_HW(lhw); lvif = VAP_TO_LVIF(vap); + vif = LVIF_TO_VIF(lvif); /* * Make sure we do not make it here without going through @@ -1326,6 +1327,23 @@ lkpi_iv_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) */ lockdep_assert_wiphy(hw->wiphy); + /* + * While we are assoc we may still send packets. We cannot delete the + * keys as otherwise packets could go out unencrypted. Some firmware + * does not like this and will fire an assert. + * net80211 needs to drive this better but given we want the disassoc + * frame out and have to unlock we are open to a race currently. + * This check should prevent problems. + * How to test: run 800Mbit/s UDP traffic and during that restart your + * supplicant. You want to survive that. + */ + if (vif->cfg.assoc) { + if (linuxkpi_debug_80211 & D80211_TRACE_HW_CRYPTO) + ic_printf(ic, "%d %lu %s: vif still assoc; not deleting keys\n", + curthread->td_tid, (unsigned long)jiffies, __func__); + return (0); + } + if (IEEE80211_KEY_UNDEFINED(k)) { ic_printf(ic, "%s: vap %p key %p is undefined: %p %u\n", __func__, vap, k, k->wk_cipher, k->wk_keyix); @@ -1370,7 +1388,6 @@ lkpi_iv_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) kc->keyidx, kc->hw_key_idx, kc->flags, IEEE80211_KEY_FLAG_BITS); #endif - vif = LVIF_TO_VIF(lvif); error = lkpi_80211_mo_set_key(hw, DISABLE_KEY, vif, sta, kc); if (error != 0) { ic_printf(ic, "%d %lu %s: set_key cmd %d(%s) for sta %6D failed: %d\n", @@ -2785,6 +2802,14 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i bss_changed = 0; bss_changed |= lkpi_disassoc(sta, vif, lhw); +#ifdef LKPI_80211_HW_CRYPTO + /* + * In theory we remove keys here but there must not exist any for this + * state change until we clean them up again into small steps and no + * code duplication. + */ +#endif + lkpi_lsta_dump(lsta, ni, __func__, __LINE__); /* Adjust sta and change state (from NONE) to NOTEXIST. */ @@ -3317,6 +3342,16 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int #ifdef LKPI_80211_HW_CRYPTO if (lkpi_hwcrypto) { + /* + * In theory we only need to do this if we changed assoc. + * If we were not assoc, there should be no keys and we + * should not be here. + */ +#ifdef notyet + KASSERT((bss_changed & BSS_CHANGED_ASSOC) != 0, ("%s: " + "trying to remove keys but were not assoc: %#010jx, lvif %p\n", + __func__, (uintmax_t)bss_changed, lvif)); +#endif error = lkpi_sta_del_keys(hw, vif, lsta); if (error != 0) { ic_printf(vap->iv_ic, "%s:%d: lkpi_sta_del_keys " @@ -3378,6 +3413,9 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int * 4) call unassign_vif_chanctx * 5) call lkpi_hw_conf_idle * 6) call remove_chanctx + * + * Note: vif->driver_flags & IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC + * might change this. */ bss_changed |= lkpi_disassoc(sta, vif, lhw);