From nobody Wed Feb 25 04:25:07 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 4fLM2J610tz6TrgS for ; Wed, 25 Feb 2026 04:25:12 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fLM2J3QCXz3vqK for ; Wed, 25 Feb 2026 04:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771993512; 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=EC29ckDPI04GHrlLySplJ9oiru0ypC7LNFvnTsnJu7w=; b=hhZoo4SkVCY+ACyBqY6D4gy4DIbXhAtTbOfXRXg0cCkKMpdP3C7KSjrYRZ5rVUROl7US9X hOdPvRwHPYJJ/NhBOAXaK7fWbdWF2QFUP6XegcAp4YseRgYhum/8Di0WTdPnKJGtxjTMbp UHvKfEJ8QPqqHvacNFQWvQ9eLq8b80m8eeMC9fk795X5YJa2VefQHXisWt5TWGKgByWKFe OSzLGQJi6v7fOxBs/3EqfijjTXJB4h9lzJK0fbtoSOHcIH0QYASmxXImDx33NiZWGAluJ+ fiRDJdyZSoQjoFF/CdyW0Qkw0HX94fw1gxYddgaTwMHgOvShvsa3WWXXkfBjZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771993512; a=rsa-sha256; cv=none; b=ZU1Ld/M0G/dY3JAraQ3EAtukpMag881r6owNi1klL9G/DcYWHufBpASng8gmZGVYIRVSGj BaWqflWFV5gFYWEKmA16UCV0RoS8mllv+rvH9OdPfj0UnwSBiljrg0lQ+LOJXxOzKGzhcN TXD6SLHjRQulLeAHMnWgrtTsp8+JFmFFnz0LP+RCZB51BlLiEsMEfe6qPkxvthEGuiYag7 CPRUeVKpaz0N4ltMB4HPsIYCrSZo+Y1jj3UZBRq5bwRYcNkoFZUQXmnXLmUKNamYfC2Art X4H0UcPXgrhSu8m/AJKwA+bbeY8wYJy5DvtUYBzWFA6+19Jc8fIeOXj1kdNUMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771993512; 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=EC29ckDPI04GHrlLySplJ9oiru0ypC7LNFvnTsnJu7w=; b=K/Aw0Fh6oXI+O8q+x4G+AP/F4kBDt2OjMMAYTX/B5g6TRcg6fH6XlcoDkabCFeGkmUYiTd clP3Z+DY1SrQ5tk26Myf4vyhB5ggaMkE2XjUu00Kn0HDLPlBcNJV2HkaG1Z4lXIUzMN56+ l1z2+mkihJs8QAz2zzi+FXEOtuxpsB5l/vsGk7PsLToEfglAlMun8ploFXcO6/DFxYIBHf Y5q86v55UDsHwlIgUHoqrAonqdgKLZSQsJl8hdTTE72Sxo4uF+1uJN88eakGd5sRGIBZ/K DDN5yCsE6r+nHgxsRmQJk1/Hc2iYi9q5Vf2ZsVVw4KvBolkQuIfAa9ZVGxVUCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fLM2J23tTzm0L for ; Wed, 25 Feb 2026 04:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36520 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 25 Feb 2026 04:25:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 96a57fc4bf4e - main - LinuxKPI: 802.11: adjust assoc check before key deletion 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/main X-Git-Reftype: branch X-Git-Commit: 96a57fc4bf4edca9a579cc47f9058253c11f8313 Auto-Submitted: auto-generated Date: Wed, 25 Feb 2026 04:25:07 +0000 Message-Id: <699e79a3.36520.36b4b94a@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=96a57fc4bf4edca9a579cc47f9058253c11f8313 commit 96a57fc4bf4edca9a579cc47f9058253c11f8313 Author: Bjoern A. Zeeb AuthorDate: 2026-02-24 23:51:43 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-02-25 04:24:50 +0000 LinuxKPI: 802.11: adjust assoc check before key deletion There is a discrepancy between the vif assoc state and the sta state (see comment in lkpi_sta_run_to_init()). Adjust the check in lkpi_iv_key_delete() and add it to lkpi_sta_del_keys() so that we can take way the keys after whatever comes first: the sta went away from AUTHORIZED (RUN) or if the vif is no longer marked assoc. This is needed as we may only take the sta down partially back to State 2 (cf. 802.11-2024, Figure 11-23) and key material is no longer valid before the vif gets cleaned up and the sta is removed entirely. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 30 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index e80cf9436b3a..550bd417c529 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1373,6 +1373,15 @@ lkpi_sta_del_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return (0); lockdep_assert_wiphy(hw->wiphy); + + if (vif->cfg.assoc && lsta->state == IEEE80211_STA_AUTHORIZED) { + if (linuxkpi_debug_80211 & D80211_TRACE_HW_CRYPTO) + ic_printf(lsta->ni->ni_ic, + "%d %lu %s: vif still assoc; not deleting keys\n", + curthread->td_tid, jiffies, __func__); + return (0); + } + ieee80211_ref_node(lsta->ni); error = 0; @@ -1452,6 +1461,15 @@ lkpi_iv_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) */ lockdep_assert_wiphy(hw->wiphy); + ni = ieee80211_ref_node(vap->iv_bss); + lsta = ni->ni_drv_data; + if (lsta == NULL) { + ic_printf(ic, "%s: ni %p (%6D) with lsta NULL\n", + __func__, ni, ni->ni_bssid, ":"); + ieee80211_free_node(ni); + return (0); + } + /* * While we are assoc we may still send packets. We cannot delete the * keys as otherwise packets could go out unencrypted. Some firmware @@ -1462,30 +1480,24 @@ lkpi_iv_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) * How to test: run 800Mbit/s UDP traffic and during that restart your * supplicant. You want to survive that. */ - if (vif->cfg.assoc) { + if (vif->cfg.assoc && lsta->state == IEEE80211_STA_AUTHORIZED) { if (linuxkpi_debug_80211 & D80211_TRACE_HW_CRYPTO) ic_printf(ic, "%d %lu %s: vif still assoc; not deleting keys\n", curthread->td_tid, jiffies, __func__); + ieee80211_free_node(ni); 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); + ieee80211_free_node(ni); return (0); } if (vap->iv_bss == NULL) { ic_printf(ic, "%s: iv_bss %p for vap %p is NULL\n", __func__, vap->iv_bss, vap); - return (0); - } - - ni = ieee80211_ref_node(vap->iv_bss); - lsta = ni->ni_drv_data; - if (lsta == NULL) { - ic_printf(ic, "%s: ni %p (%6D) with lsta NULL\n", - __func__, ni, ni->ni_bssid, ":"); ieee80211_free_node(ni); return (0); }