Bug 286219 - iwlwifi(4) kernel panic lkpi_sta_auth_to_scan with Intel Wireless 7260, 8086:08b1:8086:c060
Summary: iwlwifi(4) kernel panic lkpi_sta_auth_to_scan with Intel Wireless 7260, 8086:...
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks: iwlwifi
  Show dependency tree / graph
 
Reported: 2025-04-20 07:57 UTC by devnull
Modified: 2026-09-08 17:05 UTC (History)
4 users (show)

See Also:


Attachments
core.txt.15, edited (233.03 KB, text/plain)
2025-04-20 09:48 UTC, devnull
no flags Details
Some dmesg lines, from 2025-04-24 00:33 (5.03 KB, text/plain)
2025-04-24 15:19 UTC, devnull
no flags Details
Part of core.txt.2 (59.50 KB, text/plain)
2026-03-06 23:30 UTC, Federico Angelilli
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description devnull freebsd_committer freebsd_triage 2025-04-20 07:57:51 UTC
Dual Band Wireless-N 7260 [Wilkins Peak 2]


root@mowa219-gjp4-zbook-freebsd:~ # date ; uptime
Sun Apr 20 08:21:51 BST 2025
8:21AM  up  4:35, 5 users, load averages: 0.47, 0.82, 0.83
root@mowa219-gjp4-zbook-freebsd:~ # hw-probe -all -upload
Probe for hardware ... Ok
Reading logs ... Ok
WARNING: failed to detect EDID
Uploaded to DB, Thank you!

Probe URL: https://bsd-hardware.info/?probe=0290af8d17
root@mowa219-gjp4-zbook-freebsd:~ # cat /var/crash/info.15
Dump header from device: /dev/ada1p2
Architecture: amd64
Architecture Version: 2
Dump Length: 1721188352
Blocksize: 512
Compression: none
Dumptime: 2025-04-20 03:44:12 +0100
Hostname: mowa219-gjp4-zbook-freebsd
Magic: FreeBSD Kernel Dump
Version String: FreeBSD 15.0-CURRENT main-n276536-514c2930292e GENERIC-NODEBUG
Panic String: page fault
Dump Parity: 322177539
Bounds: 15
Dump Status: good
root@mowa219-gjp4-zbook-freebsd:~ #

----

…
iwlwifi0: Microcode SW error detected.  Restarting 0x2000000.
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 6
iwlwifi0: Loaded firmware version: 17.bfb58538.0 7260-17.ucode
iwlwifi0: 0x000021A0 | ADVANCED_SYSASSERT          
iwlwifi0: 0x00A00220 | trm_hw_status0
iwlwifi0: 0x00000000 | trm_hw_status1
iwlwifi0: 0x00000B30 | branchlink2
iwlwifi0: 0x000164C0 | interruptlink1
iwlwifi0: 0x00000000 | interruptlink2
iwlwifi0: 0xDEADBEEF | data1
iwlwifi0: 0xDEADBEEF | data2
iwlwifi0: 0xDEADBEEF | data3
iwlwifi0: 0x12017AC9 | beacon time
iwlwifi0: 0x2A8EC52C | tsf low
iwlwifi0: 0x000000EB | tsf hi
iwlwifi0: 0x00000000 | time gp1
iwlwifi0: 0x01C8DCA7 | time gp2
iwlwifi0: 0x00000000 | uCode revision type
iwlwifi0: 0x00000011 | uCode version major
iwlwifi0: 0xBFB58538 | uCode version minor
iwlwifi0: 0x00000144 | hw version
iwlwifi0: 0x40489204 | board version
iwlwifi0: 0x00570118 | hcmd
iwlwifi0: 0x24022080 | isr0
iwlwifi0: 0x01000000 | isr1
iwlwifi0: 0x00000002 | isr2
iwlwifi0: 0x004154C0 | isr3
iwlwifi0: 0x00000000 | isr4
iwlwifi0: 0x01000112 | last cmd Id
iwlwifi0: 0x00000000 | wait_event
iwlwifi0: 0x000000C0 | l2p_control
iwlwifi0: 0x00018010 | l2p_duration
iwlwifi0: 0x0000003F | l2p_mhvalid
iwlwifi0: 0x00000000 | l2p_addr_match
iwlwifi0: 0x00000005 | lmpm_pmg_sel
iwlwifi0: 0x15041745 | timestamp
iwlwifi0: 0x00008090 | flow_handler
iwlwifi0: Fseq Registers:
iwlwifi0: 0x00000000 | FSEQ_ERROR_CODE
iwlwifi0: 0x00000000 | FSEQ_TOP_INIT_VERSION
iwlwifi0: 0x00000000 | FSEQ_CNVIO_INIT_VERSION
iwlwifi0: 0x00000000 | FSEQ_OTP_VERSION
iwlwifi0: 0x00000000 | FSEQ_TOP_CONTENT_VERSION
iwlwifi0: 0x00000000 | FSEQ_ALIVE_TOKEN
iwlwifi0: 0x00000000 | FSEQ_CNVI_ID
iwlwifi0: 0x00000000 | FSEQ_CNVR_ID
iwlwifi0: 0x00000000 | CNVI_AUX_MISC_CHIP
iwlwifi0: 0x00000000 | CNVR_AUX_MISC_CHIP
iwlwifi0: 0x00000000 | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
iwlwifi0: 0x00000000 | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
iwlwifi0: 0x00000000 | FSEQ_PREV_CNVIO_INIT_VERSION
iwlwifi0: 0x00000000 | FSEQ_WIFI_FSEQ_VERSION
iwlwifi0: 0x00000000 | FSEQ_BT_FSEQ_VERSION
iwlwifi0: 0x00000000 | FSEQ_CLASS_TP_VERSION
iwlwifi0: Collecting data: trigger 2 fired.
iwlwifi0: FW error in SYNC CMD ADD_STA
#0 0xffffffff80dc8ffb at linux_dump_stack+0x1b
#1 0xffffffff847420cb at iwl_trans_pcie_send_hcmd+0x44b
#2 0xffffffff846d3d88 at iwl_trans_send_cmd+0x88
#3 0xffffffff8471d468 at iwl_mvm_send_cmd_status+0x28
#4 0xffffffff8471d56f at iwl_mvm_send_cmd_pdu_status+0x4f
#5 0xffffffff8470a9ce at iwl_mvm_sta_send_to_fw+0x35e
#6 0xffffffff8470d1dc at iwl_mvm_add_sta+0x14c
#7 0xffffffff846edcd7 at iwl_mvm_mac_sta_state_common+0x5b7
#8 0xffffffff80dc38c6 at lkpi_80211_mo_sta_state+0x36
#9 0xffffffff80db62ad at lkpi_sta_scan_to_auth+0x72d
#10 0xffffffff80db694b at lkpi_sta_assoc_to_auth+0x1b
#11 0xffffffff80dc1f13 at lkpi_iv_newstate+0x3c3
#12 0xffffffff80ceda5e at ieee80211_newstate_cb+0x11e
#13 0xffffffff80bb4ba2 at taskqueue_run_locked+0x182
#14 0xffffffff80bb5d72 at taskqueue_thread_loop+0xc2
#15 0xffffffff80b0504b at fork_exit+0x7b
#16 0xffffffff8102a9be at fork_trampoline+0xe
iwlwifi0: lkpi_sta_scan_to_auth:2113: mo_sta_state(NONE) failed: -5
iwlwifi0: lkpi_iv_newstate: error -1 during state transition 3 (ASSOC) -> 2 (AUTH)
iwlwifi0: lkpi_iv_newstate: error 95 during state transition 2 (AUTH) -> 2 (AUTH)
Configuring vt: keymap allscreens.
LibClamAV Warning: **************************************************
LibClamAV Warning: ***  The virus database is older than 7 days!  ***
LibClamAV Warning: ***   Please update it as soon as possible.    ***
LibClamAV Warning: **************************************************


Fatal trap 12: page fault while in kernel mode
cpuid = 3; apic id = 03
fault virtual address	= 0x10
fault code		= supervisor read data, page not present
instruction pointer	= 0x20:0xffffffff80db5824
stack pointer	        = 0x28:0xfffffe01434b6d30
frame pointer	        = 0x28:0xfffffe01434b6d80
code segment		= base rx0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 0 (iwlwifi0 net80211 t)
rdi: fffffe01481fd010 rsi: 0000000000000000 rdx: 0000000000000003
rcx: 0000000000000000  r8: 0000000000000001  r9: fffffe01434b7000
rax: fffff8000adf9740 rbx: 0000000000000000 rbp: fffffe01434b6d80
r10: 0000000000001388 r11: 000000007ff84851 r12: fffffe01481fd000
r13: 0000000000000000 r14: fffff8000adf9740 r15: fffffe014858c440
trap number		= 12
panic: page fault
cpuid = 3
time = 1745117052
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01434b6a80
vpanic() at vpanic+0x136/frame 0xfffffe01434b6bb0
panic() at panic+0x43/frame 0xfffffe01434b6c10
trap_pfault() at trap_pfault+0x3da/frame 0xfffffe01434b6c60
calltrap() at calltrap+0x8/frame 0xfffffe01434b6c60
--- trap 0xc, rip = 0xffffffff80db5824, rsp = 0xfffffe01434b6d30, rbp = 0xfffffe01434b6d80 ---
lkpi_sta_auth_to_scan() at lkpi_sta_auth_to_scan+0x74/frame 0xfffffe01434b6d80
lkpi_iv_newstate() at lkpi_iv_newstate+0x3c3/frame 0xfffffe01434b6df0
ieee80211_newstate_cb() at ieee80211_newstate_cb+0x11e/frame 0xfffffe01434b6e40
taskqueue_run_locked() at taskqueue_run_locked+0x182/frame 0xfffffe01434b6ec0
taskqueue_thread_loop() at taskqueue_thread_loop+0xc2/frame 0xfffffe01434b6ef0
fork_exit() at fork_exit+0x7b/frame 0xfffffe01434b6f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe01434b6f30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
KDB: enter: panic

…

----

grahamperrin@mowa219-gjp4-zbook-freebsd ~> bectl list -c creation | tail -n 12
1500035-016-base             -      -          986M  2025-04-08 19:31
1500036-001-base             -      -          1.06G 2025-04-10 01:00
1500036-002-base             -      -          6.75G 2025-04-11 09:22
1500036-003-base-ports       -      -          2.28G 2025-04-12 02:42
1500036-004-base             -      -          1.65G 2025-04-12 14:09
1500037-001-base             -      -          825M  2025-04-13 02:06
1500037-002-base             -      -          824M  2025-04-13 15:05
1500037-003-base             -      -          942M  2025-04-15 09:35
1500037-004-base             -      -          1.06G 2025-04-16 02:52
1500037-005-base             -      -          1.06G 2025-04-17 15:22
1500037-006-base             NR     /          330G  2025-04-18 03:11
1500037-007-base             -      -          1.19G 2025-04-19 02:56
grahamperrin@mowa219-gjp4-zbook-freebsd ~> grep 1500037-007-base ~/Documents/boot\ environments.txt
1500037-007-base                2025-04-19 02:56 main-n276558-b3d89a0cde94 GENERIC-NODEBUG da87f293d59b0e4936ba8131d42858316cf2acac
grahamperrin@mowa219-gjp4-zbook-freebsd ~>


I stepped back from 1500037-007-base to 1500037-006-base to avoid bug 286193.

Then, a one-off test of iwlwifi instead of iwm. Now back with iwm.

Additional details to follow.
Comment 1 devnull freebsd_committer freebsd_triage 2025-04-20 09:48:45 UTC
Created attachment 259725 [details]
core.txt.15, edited

Edited to remove things such as on-screen file content from the dmesg section (use of an editor whilst in single user mode). 

Note to self: 

cd /var/crash && grep -e '(E|e)ther' -e inet -e '(S|s)erial' -e '(S|s)/(N/n)' -e ssid -e nano -e 'ee\ ' -e 'vi\ ' core.txt.
Comment 2 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-04-22 00:14:11 UTC
And what happened before the firmware crash in the log? Hmm dmesg from #2 doesn't have much more.

I could be wrong but this is not a valid command by the driver:
iwlwifi0: 0x01000112 | last cmd Id

The backtrace from the firmware crash indicates there was an ADD_STA going on.

The kernel panic happened on a different path in the follow-up.
lkpi_sta_auth_to_scan+0x74 according to the crash info is l2240:

   2237         KASSERT(lsta != NULL && lsta->ni != NULL, ("%s: lsta %p ni %p "
   2238             "lvif %p vap %p\n", __func__,
   2239             lsta, (lsta != NULL) ? lsta->ni : NULL, lvif, vap));
   2240         ni = lsta->ni;                  /* Reference held for lvif_bss. */
   2241         sta = LSTA_TO_STA(lsta);

(gdb) p/x &((struct lkpi_sta *)0)->ni
$1 = 0x10

would mean the ni on the lsta went NULL, something in a DEBUG kernel the kassert would catch; given the kassert documnets this should not happen, I wonder even more.  especially given we haven't seen problems with that since last year some point I believe.

Is this reproducible on your build?
Comment 3 devnull freebsd_committer freebsd_triage 2025-04-23 23:21:14 UTC
pkgbase here, nothing unusual about the build. 

The original panic was on base 514c2930292e (2025-04-17 22:05:30 +0000) <https://cgit.freebsd.org/src/log/?id=514c2930292e&qt=range&q=514c2930292e> with GENERIC-NODEBUG.

I'm now up to base e6c91f8e5be6 (2025-04-22 23:45:49 +0000) <https://cgit.freebsd.org/src/log/?id=514c2930292e&qt=range&q=514c2930292e..e6c91f8e5be6>

So far, no panic with GENERIC-NODEBUG or GENERIC. 

Currently connected to ssid piano channel 2 (2417 MHz 11g). 

The router does have a separate ssid, piano5, on 5 GHz (802.11a/n/ac). At least with e6c91f8e5be6, I am not yet able to gain an Internet connection. The TalkTalk router is set to WPA-PSK/WPA2-PSK. 


grahamperrin@mowa219-gjp4-zbook-freebsd ~> ifconfig wlan1
wlan1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=0
	ether ⋯
	inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
	groups: wlan
	ssid piano channel 2 (2417 MHz 11g) bssid ⋯
	regdomain ETSI country GB authmode WPA2/802.11i privacy ON
	deftxkey UNDEF TKIP 2:128-bit txpower 30 bmiss 7 scanvalid 60
	protmode CTS wme roaming MANUAL
	parent interface: iwlwifi0
	media: IEEE 802.11 Wireless Ethernet DS/1Mbps mode 11g
	status: associated
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
grahamperrin@mowa219-gjp4-zbook-freebsd ~>
Comment 4 devnull freebsd_committer freebsd_triage 2025-04-24 00:17:04 UTC
> The router does have a separate ssid, piano5, on 5 GHz (802.11a/n/ac). 
> At least with e6c91f8e5be6, I am not yet able to gain an 
> Internet connection.

net-mgmt/wifimgr
<https://www.freshports.org/net-mgmt/wifimgr/>

At 00:33 I used WiFi Networks Manager to connect to piano5, instead of piano. 

The row for piano5 lacked a green network icon. AFAIK this icon does appear when there's a usable connection to the Internet. 

At 00:34 the GUI (KDE Plasma) froze, I suspected a kernel panic. The automated restart occurred around thirteen minutes later. 

/var/crash/info.17

Dump header from device: /dev/ada1p2
  Architecture: amd64
  Architecture Version: 2
  Dump Length: 4521283584
  Blocksize: 512
  Compression: none
  Dumptime: 2025-04-24 00:34:31 +0100
  Hostname: mowa219-gjp4-zbook-freebsd
  Magic: FreeBSD Kernel Dump
  Version String: FreeBSD 15.0-CURRENT main-n276675-e6c91f8e5be6 GENERIC
  Panic String: lkpi_sta_auth_to_scan: lsta 0 ni 0 lvif 0xfffffe015ec73000 vap 0xfffffe015ec73010

  Dump Parity: 2087984497
  Bounds: 17
  Dump Status: good
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-04-24 00:30:48 UTC
(In reply to Graham Perrin from comment #4)

So the KASSERT caught what I mentioned in #c2.

That means the iv_bss (or rather our local sta) copy went away while we were still holding the ic lock and we were holding a reference for the ni cached there as well.

This will need a separate investigation;  do you have a core dump again this time to see if there was a firmware crash before as well again?
Comment 6 devnull freebsd_committer freebsd_triage 2025-04-24 00:54:37 UTC
I do have a core dump.

> … This will need a separate investigation; …

Would you like a separate bug report?

Before I opened this bug 286219, I did wonder whether it is somehow a continuation of bsdinstall-specific bug 271979 …
Comment 7 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-04-24 07:59:06 UTC
(In reply to Graham Perrin from comment #6)

No, sorry, what I meant was that I need to do a review pass on the code if or how this can happen.

For your core file, can your check in the crashinfo report message buffer (dmesg) if there was firmware crash before hitting the KASSERT?  That would be really helpful to know,
Comment 8 devnull freebsd_committer freebsd_triage 2025-04-24 15:19:04 UTC
Created attachment 259833 [details]
Some dmesg lines, from 2025-04-24 00:33

Part of core.txt.17
Comment 9 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-04-24 15:46:44 UTC
(In reply to Graham Perrin from comment #8)

Thanks. So the real problem again was a FW crash on a STA_ADD and again:
iwlwifi0: 0x01000112 | last cmd Id

I'll go and dig this weekend.  Won't make it to this before most likely.
Comment 10 Federico Angelilli 2026-03-06 23:22:12 UTC
Hello, I found a similar crash on my Thinkpad T14 (Comet Lake PCH-LP CNVi WiFi), both on 15-RELEASE and 15-STABLE.
Hardware probe: https://bsd-hardware.info/?probe=beae9b0886

The null dereference can be easily reproduced by connecting and disconnecting in quick succession.

The affected code seems the same:
#8  lkpi_sta_auth_to_scan (vap=0xfffffe010fb3c010, nstate=<optimized out>, arg=<optimized out>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:2612
2612		ni = lsta->ni;			/* Reference held for lvif_bss. */


root@t14:/var/crash # cat info.2
Dump header from device: /dev/nda0p3
  Architecture: amd64
  Architecture Version: 2
  Dump Length: 924094464
  Blocksize: 512
  Compression: none
  Dumptime: 2026-03-04 23:47:24 +0100
  Hostname: t14
  Magic: FreeBSD Kernel Dump
  Version String: FreeBSD 15.0-STABLE stable/15-n282340-ddefff3810c1 GENERIC
  Panic String: page fault
  Dump Parity: 1437632618
  Bounds: 2
  Dump Status: good


Let me know if I should open a separate bug report
Comment 11 Federico Angelilli 2026-03-06 23:30:40 UTC
Created attachment 268587 [details]
Part of core.txt.2

Part of core.txt.2: dmesg and kgdb dump
Comment 12 Bjoern A. Zeeb freebsd_committer freebsd_triage 2026-03-07 01:23:48 UTC
(In reply to Federico Angelilli from comment #10)

If I am not mistaken that is a stable/15 kernel from mid-Februar?

On a debug kernel a KASSERT would trigger for that NULL pointer;  the real problem is the firmware crash just before that.

I almost assume your problem was fixed in main the last days;  those changes will be MFCed some time next week to stable/15.  Do you think you could re-test with that?

Also can you give me a recipe how you reproduce this (sequence of commands) as that would help in the future?
Comment 13 Federico Angelilli 2026-03-07 01:37:52 UTC
Indeed this kernel was built a couple weeks ago.
I wrote here because I didn't see activity, so I'm glad that this should be fixed now.
I will test in a few days and let you updated.

As for reproducing the crash, I discovered the problem like so: if in wpa_gui I press repeatedly the connect button the kernel consistently panics. Same for wpa_cli.
Maybe it's some kind of race condition, but you probably will know more than me.
Comment 14 Federico Angelilli 2026-03-07 02:02:17 UTC
For reference, this triggers the crash reliably on my machine:
while : ; do wpa_cli reassociate; done

While this spamming scans causes another kind of firmware failure (but no panic, probably unrelated):
while : ; do wpa_cli scan; done
Comment 15 Bjoern A. Zeeb freebsd_committer freebsd_triage 2026-03-07 09:16:49 UTC
(In reply to Federico Angelilli from comment #14)

Just for me: your crash also was on a
iwlwifi0: Detected Intel(R) Wi-Fi 6 AX201 160MHz
as we are currently getting more reports for that chipset.

I didn't even know about wpa_gui .

The wpa_cli reassoc I had running for a long while now without any success of reproducing this.  I'll try with a non-DEBUG kernel next.
I assume that is the same problem thj reported in PR 290045 .
Comment 16 Federico Angelilli 2026-03-07 10:50:40 UTC
I didn't see that bug because I explicitly searched for lkpi, but it indeed seems related.

Maybe it's important but I also use the ETSI regdomain. I can easily reproduce it and sometimes it happens accidentally, thus the mention of wpa_gui.
Comment 17 commit-hook freebsd_committer freebsd_triage 2026-03-08 17:07:59 UTC
A commit in branch main references this bug:

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

commit 53c69fd933dc49f69d5603fb27ce51064ebe681e
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-08 12:48:51 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-08 13:49:52 +0000

    LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL

    Usually after a firmware crash, we see reports of crashes in
    lkpi_sta_auth_to_scan().  One of the last ones was in the PR
    mentioned below.

    These crashes are often attributed as the problem while the real
    problem happened before.

    At this point try avoid the NULL pointer and to fail graciously if
    lvif->iv_bss (lsta) is no longer set.  This way users have a chance
    to possibly recover using netif restart wlan0 rather than dealing
    with a panic.

    See if this helps us to better track down the original problems
    rather than the follow-up crash.

    On a debug kernel the KASSERT should normally have caught that
    condition as well but we see panics on page faults were the log
    line was there but then the lsta->ni deref has happened, which is
    after the KASSERT.  I have not checked if this is a reordering problem
    or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS.

    Sponsored by:   The FreeBSD Foundation
    PR:             286219 #c11
    MFC after:      3 days

 sys/compat/linuxkpi/common/src/linux_80211.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
Comment 18 commit-hook freebsd_committer freebsd_triage 2026-03-11 16:54:28 UTC
A commit in branch stable/15 references this bug:

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

commit 86417d5b061f7d385a09ae557504e8ef306ecbf9
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-08 12:48:51 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-11 16:53:24 +0000

    LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL

    Usually after a firmware crash, we see reports of crashes in
    lkpi_sta_auth_to_scan().  One of the last ones was in the PR
    mentioned below.

    These crashes are often attributed as the problem while the real
    problem happened before.

    At this point try avoid the NULL pointer and to fail graciously if
    lvif->iv_bss (lsta) is no longer set.  This way users have a chance
    to possibly recover using netif restart wlan0 rather than dealing
    with a panic.

    See if this helps us to better track down the original problems
    rather than the follow-up crash.

    On a debug kernel the KASSERT should normally have caught that
    condition as well but we see panics on page faults were the log
    line was there but then the lsta->ni deref has happened, which is
    after the KASSERT.  I have not checked if this is a reordering problem
    or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS.

    Sponsored by:   The FreeBSD Foundation
    PR:             286219 #c11

    (cherry picked from commit 53c69fd933dc49f69d5603fb27ce51064ebe681e)

 sys/compat/linuxkpi/common/src/linux_80211.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)