From nobody Fri Jul 01 14:57:48 2022 X-Original-To: dev-commits-src-branches@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 0546A8A3B4D; Fri, 1 Jul 2022 14:57:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LZJGP0ydNz4djP; Fri, 1 Jul 2022 14:57:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656687469; 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=m1ExnYLAF/HVouNLIugzkvez6R9o5z/00+dfBfHse58=; b=A5lhMoryvX71nm9g2t9oGQ8ZASN4gOg1jRJyFk+c7JnEQKBgexfpViWHuOqF54P0BBHNZF Uznz1kmnrleXKyLKxdJRf1+i+wltH/efuign7Su/ut7K8bm68nO4ZuQnjZzVMY4k5jntHc lm6i0YkemMPiB1e+npGgXz5n6PA9MR0xrH3amBqgXiD/GV4LKOUqHgmCJNHkk2Yxdn+wGG 448Nsbj3dPwd94H4Alvl9WJsxk2tSSXfse8zvNofDQw+pH4TKGKajguHyqMgRAN+EPFmbq SUiVkzZEx7PwE2B3A0C9BYuuPodWefT6n1mZct/f0Yxrx4wIkUluArPH8Kc9wA== 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 EDE3E1D85B; Fri, 1 Jul 2022 14:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 261EvmYX057995; Fri, 1 Jul 2022 14:57:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 261EvmnO057994; Fri, 1 Jul 2022 14:57:48 GMT (envelope-from git) Date: Fri, 1 Jul 2022 14:57:48 GMT Message-Id: <202207011457.261EvmnO057994@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: 2217448bcc2f - stable/13 - LinuxKPI: 802.11: cleanup lsta better List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 2217448bcc2f8e8d5f5c20ab0b1be4511bf5fd01 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656687469; 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=m1ExnYLAF/HVouNLIugzkvez6R9o5z/00+dfBfHse58=; b=wVO4b27l8CC+EnC/Hdo0oKPkNj+QCGZY1G4Yk1dd3J6zw9ibYFWCmySqf8pBapZdl1A4vg D3gWHhkp3LyVcyCEe9HpQWNCz0QY3ox1RbRibre9HKhS1vUUxgl9/MoPBUwKfEVjN2mD43 BQOMzKi6qT2C1MLLlk3/cXJbNqdsIPd9A7C+r0v9o/Dy5AXbX+uSojaN/Ued5nvowMeszS EwVMGI0aZApnLMkOAbf+36QHYgCVIXZ+Bg6Hl0KpnGjzanxIHUgGwaDvEDJW34qYarFai8 4wESPgekBF9SEEzCNNvz/vynr3eHH+yTZ78cF++1eognx3LqQJkSkhf9ZF3hrQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656687469; a=rsa-sha256; cv=none; b=eDb/O6RL2AEr5Qg7jV4h1Nq4fudIu+pvGPxopzr/1CdfyJnODZVAEdC6DeevNIGBwb3JsZ hc7qJls9XY6YcO166pnus8iKnHo5AyWmKhCgoFH+GqYUx+KFTnZSagXzeO3RJn98UkYCHi k3fvYmz/Qw3Ejp5GA9ysaHg1zJRAZ2+kC56HEb3DQFHVJ+nVidHTu/6KiiAzNqWyVTqXxa c0V8DC5q4yEWWrulHz53D8e2ry50gpBvQEGYbiWjAloMaJVV1bnRGHWqBaOtB267BEnu8A 8dc7DSdGNGFBHKKYCZZ7rs4zxT2OdP4W7Nx8luJXrH2+h51KQgipsQ6XialqPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2217448bcc2f8e8d5f5c20ab0b1be4511bf5fd01 commit 2217448bcc2f8e8d5f5c20ab0b1be4511bf5fd01 Author: Bjoern A. Zeeb AuthorDate: 2022-06-26 19:13:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-07-01 13:50:03 +0000 LinuxKPI: 802.11: cleanup lsta better This changes cleans up lsta from the VIF station list as well as deals with freeing the lsta itself so it is not leaked. lkpi_iv_update_bss() makes this more complicated than it should be as we ties more sta state (incl. drv/fw) to the node that net80211 does not know about. There is more work to be done detangling this now that is better understood. (cherry picked from commit e24e8103e0e2140751a1b2baf7b68725ca20aaa2) --- sys/compat/linuxkpi/common/src/linux_80211.c | 29 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 728f732e5a75..522e3c92906f 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -179,9 +179,12 @@ lkpi_lsta_remove(struct lkpi_sta *lsta, struct lkpi_vif *lvif) lsta->ni = NULL; ni->ni_drv_data = NULL; - ieee80211_free_node(ni); + if (ni != NULL) + ieee80211_free_node(ni); + + IMPROVE("more from lkpi_ic_node_free() should happen here."); - IMPROVE("free lsta here? We won't have a pointer to it from the node anymore."); + free(lsta, M_LKPI80211); } static struct lkpi_sta * @@ -998,12 +1001,15 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int goto out; } lsta->ni = ieee80211_ref_node(ni); - LKPI_80211_LVIF_LOCK(lvif); - TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry); - LKPI_80211_LVIF_UNLOCK(lvif); } else { lsta = ni->ni_drv_data; } + + /* Insert the [l]sta into the list of known stations. */ + LKPI_80211_LVIF_LOCK(lvif); + TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry); + LKPI_80211_LVIF_UNLOCK(lvif); + /* Add (or adjust) sta and change state (from NOTEXIST) to NONE. */ KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni)); KASSERT(lsta->state == IEEE80211_STA_NOTEXIST, ("%s: lsta %p state not " @@ -2775,7 +2781,6 @@ lkpi_ic_node_init(struct ieee80211_node *ni) struct ieee80211com *ic; struct lkpi_hw *lhw; struct lkpi_sta *lsta; - struct lkpi_vif *lvif; int error; ic = ni->ni_ic; @@ -2787,17 +2792,11 @@ lkpi_ic_node_init(struct ieee80211_node *ni) return (error); } - lvif = VAP_TO_LVIF(ni->ni_vap); - lsta = ni->ni_drv_data; /* Now take the reference before linking it to the table. */ lsta->ni = ieee80211_ref_node(ni); - LKPI_80211_LVIF_LOCK(lvif); - TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry); - LKPI_80211_LVIF_UNLOCK(lvif); - /* XXX-BZ Sync other state over. */ IMPROVE(); @@ -2847,11 +2846,11 @@ lkpi_ic_node_free(struct ieee80211_node *ni) mtx_destroy(&lsta->txq_mtx); /* Remove lsta if added_to_drv. */ - /* Remove lsta from vif */ - - /* remove ref from lsta node... */ + /* Remove lsta from vif */ + /* Remove ref from lsta node... */ /* Free lsta. */ + lkpi_lsta_remove(lsta, VAP_TO_LVIF(ni->ni_vap)); out: if (lhw->ic_node_free != NULL)