From nobody Wed Apr 23 16:25:25 2025 X-Original-To: dev-commits-src-main@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 4ZjPbV2dlGz5tbGQ; Wed, 23 Apr 2025 16:25:26 +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 4ZjPbV03Grz49cR; Wed, 23 Apr 2025 16:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745425526; 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=6/kgzlZkekSGICpog0qep8RBSksWkEh5qqj2cqtdK34=; b=QaKgHELQi0oDAVRCYrPG9+C98yLkZeU+YFWS0I5j2vbc+UV0X4sT0/JT+YZEWellieTiRw eBd5NCFVTfbUI0ys16HfkJbuHBQjghsq2zLB3Qtn3+3lszCaNjRbphKvCVi6E8w7/DHqMP XovTQPlUDAN8QEKfwL9XrzmxCptWCnua5/2BYFFNxXKnr49M478egom3z/+fizgmxBXf7P oW5+rmiGxg9VQ2zC9GyIhhnUXseRv4VkU42Dbni3pzushpaMZy0FWC7xHzKwosCkFmNkkb lFBOi3FQ/oxMjG7O2znkT5n6QoLc0s2sfMBvrLOceIre+15Y4bg9y9mcTJWo4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745425526; a=rsa-sha256; cv=none; b=odRC2yg4xjUoJvQ77kfcO/fmVDrhx23OLWZ8Er9SZ08+XTNQXxO7dmj1BoGzananksf1C/ yvqJqWyJDraAiW6UMHjKdZPDB8PRh85fr6itJu6JqgE7a4EMAAEZQjqoiAdoUOMrXQ33Zp ZlzSRaUrRJPF1SkSjlGgNHasrcb6RSrEXe59Yh29K/vU8syg/qes3OadgjLZxi4WdUrNbk udx17WPs3Z60584CdkQwKKV/iu0kS0bj/iaTJO9Dv12OEaH8djnDyMGFdJGn7rmenOROWf Vcpt2Niy/2oXD6Q/v+FCa82H2pRvUCO7+7WMIySG/2A2+23vJpbqPAYujbMR+Q== 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=1745425526; 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=6/kgzlZkekSGICpog0qep8RBSksWkEh5qqj2cqtdK34=; b=QchDkltgByTc5Y55W8P4I8v0Upul+nPz80BOCSHPtbZXVk4ZTITvfEjJJXRGW+G+24vb4p VFav3A058I/buaM7fZ9oCEAONkfYJ8G3tqUXWjRNfKNrztwb/AZY5HSMqKmBCRy2lqasgt 0rf0NnR7YJhaOqhabZNabjOOPQiIn7N+W/w4NLUm+r+M6KCiOdLEIGXNegGHVG+J5Ze6g7 fhj0RrBZWM6N0U7ddTB4ma8fW9GmArKrrjKPr8fEvxr6WmbfI2ZlyvYm8fQLss2EXJT319 YgQmmHyLwR2wkXr1O5Vey1K85l1hsDCDohNEaqc6goCUIM9x0QECFjYnVsuvFg== 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 4ZjPbT6mxGz19ks; Wed, 23 Apr 2025 16:25:25 +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 53NGPP7T082101; Wed, 23 Apr 2025 16:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53NGPP1Z082098; Wed, 23 Apr 2025 16:25:25 GMT (envelope-from git) Date: Wed, 23 Apr 2025 16:25:25 GMT Message-Id: <202504231625.53NGPP1Z082098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a6413bce4e36 - main - LinuxKPI: 802.11: further improve key updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: a6413bce4e36e4176bbcf16528cc3aeb834965ba Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a6413bce4e36e4176bbcf16528cc3aeb834965ba commit a6413bce4e36e4176bbcf16528cc3aeb834965ba Author: Bjoern A. Zeeb AuthorDate: 2025-04-16 21:11:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-23 16:24:21 +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 MFC after: 3 days Fixes: a6165709e3c8 --- 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 eef8024c5e84..6f9fda2e2234 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1527,6 +1527,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; @@ -1547,7 +1548,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) @@ -1555,6 +1565,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. @@ -1604,6 +1618,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;