From nobody Tue Apr 29 11:42:00 2025 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 4Zmz1j0tM9z5tvFr; Tue, 29 Apr 2025 11:42:01 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zmz1h5XBjz3xLQ; Tue, 29 Apr 2025 11:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745926920; 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=JlJQCs7JrpQMyBz9oWIfkM2SIsBPzNwTU54lfd+x0gw=; b=g3r0Q/PVXoEfUnO94z56os5QIJ+pMznCia5NBufcAg8MZfQd0rdHFlo7ah2fxyBa846K7F pC6XX/V29Crwn8+kwxw3m7+D5kZyZnZHSnY4waKCTFs1HhZ80mT6kk4M1HHuIRk6kJlFvB eF6RhRe1orbnhuaNFOzrYYRnOd7uViOxEv4yJ2fvu8I90JIzjVgOSdDR0Lo02ItJQAOBlk yhvLb3ooOxFZMrK+3VnLqPqhRB02Oo/a0gcvmZU5d/YHYJt6iM0RSW3i4S0PE2cyGWJ5Gg VDagmBTW+FsStunqjEuLuAxXSJaKprg5lXdn5Wc1U+3nZadgLmA8XpB5bMhEtA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745926920; a=rsa-sha256; cv=none; b=VF4aKXRk1e+QrKSVVDaAr354Et3cWn4uUyf4Sel2WRpdGE+A1cxT/Nw/UajGOD/nt70jFy gCw4kMezrjbmJwBh0blvJkdS9pBtuYkpnr2hFz51z1AbJaj+12wVK019IQFmaF+DxzzU+Q Tgb/xug9uHVnuBmTr7FI76imwSNO5D5O/ieKE7MpVSN0o7gih5x77uhph/N/XAJmDqipgw C1yx+QLTO1vCTh5HATM/ciiFzrsJ2gPCWHzvLwCGpr9DMNggKlmB+YW8F2kY7rzkU8PxX4 J7Pwy7Rx3p8ActYqIH5Q8U271/AflK+Gc4K94RAKNNmOYEMzx7XBWFI2vZrqig== 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=1745926920; 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=JlJQCs7JrpQMyBz9oWIfkM2SIsBPzNwTU54lfd+x0gw=; b=I3V+Iiv5qegBWvkK4tXiGDj8ck4gjcI6VTyp0WSIUdGfsgewYWhqaTWJ9lJ+RsLD2Sk6re wNuxzkFkyUSQyp1neXTIZkedHuML5eMCgQc5HpHDLRAoU+jUPxKPRHvGhw3bCPJNIAfT0x y6xyC6WJaXusAnH0sZhhxPTsIKZRUjw7pqksM01VFxtLAIdRrQkm+RW7N/Cb3cf0TMAGEs 1blOibHp3r2HF96NOyoJJAnjTxdyJPup1T+dtsp3h9thfowTvseA9YGcnD+dcnwfwDwdhH 9vKGkRY3ksIhe7mc7xgygIyz9P+/sjWRsM327t4gYoirtxoeyIAqpjJrZopP9g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Zmz1h4xBvz3ch; Tue, 29 Apr 2025 11:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53TBg0X2047509; Tue, 29 Apr 2025 11:42:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53TBg013047506; Tue, 29 Apr 2025 11:42:00 GMT (envelope-from git) Date: Tue, 29 Apr 2025 11:42:00 GMT Message-Id: <202504291142.53TBg013047506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ecc5344225cb - stable/14 - LinuxKPI: 802.11: further improve key updates 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: ecc5344225cb85250c36159193180484c3f4bd10 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ecc5344225cb85250c36159193180484c3f4bd10 commit ecc5344225cb85250c36159193180484c3f4bd10 Author: Bjoern A. Zeeb AuthorDate: 2025-04-16 21:11:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-29 10:49:32 +0000 LinuxKPI: 802.11: further improve key updates Make sure the iv_bss noce does not go away in the middle of a key update given we unlocked. Just as a precaution. No real case has been seen so far. Sponsored by: The FreeBSD Foundation Fixes: a6165709e3c8 (cherry picked from commit a6413bce4e36e4176bbcf16528cc3aeb834965ba) --- sys/compat/linuxkpi/common/src/linux_80211.c | 22 +++++++++++++++++++++- sys/compat/linuxkpi/common/src/linux_80211.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 964d995db728..4ac8856a09e5 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1528,6 +1528,7 @@ lkpi_iv_key_update_begin(struct ieee80211vap *vap) struct lkpi_hw *lhw; struct ieee80211_hw *hw; struct lkpi_vif *lvif; + struct ieee80211_node *ni; bool icislocked, ntislocked; ic = vap->iv_ic; @@ -1548,7 +1549,16 @@ lkpi_iv_key_update_begin(struct ieee80211vap *vap) lvif->ic_unlocked, lvif->nt_unlocked); #endif - /* This is inconsistent net80211 locking to be fixed one day. */ + /* + * This is inconsistent net80211 locking to be fixed one day. + */ + /* Try to make sure the node does not go away while possibly unlocked. */ + ni = NULL; + if (icislocked || ntislocked) { + if (vap->iv_bss != NULL) + ni = ieee80211_ref_node(vap->iv_bss); + } + if (icislocked) IEEE80211_UNLOCK(ic); if (ntislocked) @@ -1556,6 +1566,10 @@ lkpi_iv_key_update_begin(struct ieee80211vap *vap) wiphy_lock(hw->wiphy); + KASSERT(lvif->key_update_iv_bss == NULL, ("%s: key_update_iv_bss not NULL %p", + __func__, lvif->key_update_iv_bss)); + lvif->key_update_iv_bss = ni; + /* * ic/nt_unlocked could be a bool given we are under the lock and there * must only be a single thread. @@ -1605,6 +1619,12 @@ lkpi_iv_key_update_end(struct ieee80211vap *vap) */ icislocked = refcount_release_if_last(&lvif->ic_unlocked); ntislocked = refcount_release_if_last(&lvif->nt_unlocked); + + if (lvif->key_update_iv_bss != NULL) { + ieee80211_free_node(lvif->key_update_iv_bss); + lvif->key_update_iv_bss = NULL; + } + wiphy_unlock(hw->wiphy); /* diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index a5c052c78db0..89afec1235bd 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -191,6 +191,7 @@ struct lkpi_vif { struct lkpi_sta *lvif_bss; + struct ieee80211_node *key_update_iv_bss; int ic_unlocked; /* Count of ic unlocks pending (*mo_set_key) */ int nt_unlocked; /* Count of nt unlocks pending (*mo_set_key) */ bool lvif_bss_synched;