git: ba0e9f526481 - stable/13 - LinuxKPI: 802.11: initalize lsta to NULL in linuxkpi_ieee80211_rx()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 12 Jun 2024 19:16:56 UTC
The branch stable/13 has been updated by bz:

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

commit ba0e9f526481d087bb9b3dfeb341134a5d56a7c5
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-06-05 22:35:00 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-06-12 17:02:05 +0000

    LinuxKPI: 802.11: initalize lsta to NULL in linuxkpi_ieee80211_rx()
    
    The logic following this new assignment in some cases may not set lsta
    but the later tracing is checking for it to be != NULL.
    With lsta not initialized that check may not hold up and later we would
    dereference lsta->state and possibly panic.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D45507
    
    (cherry picked from commit 582469016aed4fac3a7ead24dc31000edbb7e823)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index e5fcb81dce6a..b48f64fb1b0f 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4926,6 +4926,7 @@ no_trace_beacons:
 		goto err;
 	}
 
+	lsta = NULL;
 	if (sta != NULL) {
 		lsta = STA_TO_LSTA(sta);
 		ni = ieee80211_ref_node(lsta->ni);