git: 71df58aefcf8 - main - LinuxKPI: 802.11: plug a ni leak in lkpi_sta_assoc_to_run()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 05 Jun 2022 21:13:56 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=71df58aefcf8be21b32e2a7b83da6d0facb8b326

commit 71df58aefcf8be21b32e2a7b83da6d0facb8b326
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-06-05 21:10:01 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-06-05 21:12:55 +0000

    LinuxKPI: 802.11: plug a ni leak in lkpi_sta_assoc_to_run()
    
    In lkpi_sta_assoc_to_run() we are going through some code segments
    twice (auth->assoc, assoc->authorized).  The 2nd time we shall not
    re-gain a reference on the net80211 node as otherwise it'll leak.
    Likewise we do not have to re-set lsta and sta.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index f2a5d6dac706..fd17aba19d96 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1590,12 +1590,9 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 	}
 
 	/* Update sta_state (ASSOC to AUTHORIZED). */
-	ni = ieee80211_ref_node(vap->iv_bss);
-	lsta = ni->ni_drv_data;
 	KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
 	KASSERT(lsta->state == IEEE80211_STA_ASSOC, ("%s: lsta %p state not "
 	    "ASSOC: %#x\n", __func__, lsta, lsta->state));
-	sta = LSTA_TO_STA(lsta);
 	error = lkpi_80211_mo_sta_state(hw, vif, sta, IEEE80211_STA_AUTHORIZED);
 	if (error != 0) {
 		IMPROVE("undo some changes?");