git: 582469016aed - main - LinuxKPI: 802.11: initalize lsta to NULL in linuxkpi_ieee80211_rx()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 07 Jun 2024 21:14:08 UTC
The branch main has been updated by bz:

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

commit 582469016aed4fac3a7ead24dc31000edbb7e823
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-07 21:06:31 +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
    MFC after:      3 days
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D45507
---
 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 03b36e6526bd..cd1897a08ccd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -5054,6 +5054,7 @@ no_trace_beacons:
 		goto err;
 	}
 
+	lsta = NULL;
 	if (sta != NULL) {
 		lsta = STA_TO_LSTA(sta);
 		ni = ieee80211_ref_node(lsta->ni);