Repository navigation
Description
Describe the bug
The wifi firmware of rpi4 (and likely rpi5, being based on the same chip) occasionally crashes when using the integrated BCM43455 wifi chip as an AP with WPA3 SAE external authentication (the only SAE mode supported by the latest firmware). It's completely random, but usually takes several hours of continuous operation for the crash to manifest.
The original driver did not provide a trap dump. I've instrumented the code to do so:
b82a9e1
Maybe this dump is something Infineon can have a look at? Unfortunately the bug does not happen with debugging messages on, which makes it difficult to track.
Steps to reproduce the behaviour
Start the wifi as a AP (e.g. using hostapd). Configure pure WPA3/SAE:
wpa_key_mgmt=SAE
sae_password=<pwd>
sae_pwe=1
sae_groups=19
transition_disable=1
Observe the crash after a while.
Device (s)
Raspberry Pi 4 Mod. B
System
Wifi firmware version: BCM4345/6 wl0: Oct 28 2024 23:27:00 version 7.45.286 (be70ab3 CY) FWID 01-95efe7fa
Kernel version: 6.18.39
Logs
kernel: brcmfmac: brcmf_sdio_hostmail: mailbox indicates firmware halted
kernel: brcmfmac: brcmf_sdio_dump_trap: dump_trap: sh.flags=0x401 trap_addr=0x25fec8
kernel: brcmfmac: brcmf_sdio_dump_trap: firmware trap: type 0x4 epc 0x0019a330 pc 0x0019a330 lr 0x0019a30d sp 0x0025ff20
r0 0x002036d8 r1 0xd110b560 r2 0xd110b530 r3 0x00199084
r4 0x00000028 r5 0x00000030 r6 0x00000000 r7 0x00198718
kernel: ieee80211 phy0: brcmf_fw_crashed: Firmware has halted or crashed
kernel: ieee80211 phy0: brcmf_netdev_start_xmit: xmit rejected state=0
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_cfg80211_stop_ap: SET SSID error (-5)
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_cfg80211_stop_ap: BRCMF_C_DOWN error -5
systemd-networkd[416]: wlan0: Link DOWN
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
systemd-networkd[416]: wlan0: Lost carrier
kernel: ieee80211 phy0: brcmf_cfg80211_stop_ap: setting AP mode failed -5
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_cfg80211_stop_ap: BRCMF_C_UP error -5
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
Additional context
I decoded the firmware trap against the actual firmware image using AI (cyfmac43455-sdio.bin, rambase 0x198000):
Type 0x4 = ARM Data Abort. Faulting instruction at PC 0x19a330 = STR r3, [r4, #4], with r4 = 0x28 → the firmware tried to write to address 0x2c (a near-null/garbage pointer).
Disassembling the surrounding block (0x19a320–0x19a34e) shows it's the firmware's heap allocator free-block coalescing routine:
- it walks free-block headers reading size/next (LDR [r3,#0], LDR [r3,#4]),
- accumulates size + 8 (8-byte block header),
- merges adjacent blocks by rewriting next pointers (STR r3,[r4,#4], STR r3,[r0,#4]).
The register values confirm heap free-list corruption:
- r1 = 0xd110b560, r2 = 0xd110b530 — impossible addresses (poison), 0x30 apart.
- r4 = 0x28 — a block-header pointer that's been overwritten with the integer 40.
So the crash seems to be a firmware heap corruption, detected when the allocator next coalesces free blocks.
Activity
bnicolae commentedon Jul 30, 2026
The culprit is likely the mainline code never receiving at least a minimal set of patches to work with the latest firmware. In particular, there are several new firmware iovars like "bss" and "extsae_pwe" that are left uninitialized. I suspect this probably skips the creation of some internal data structures on the heap and later operations trigger illegal memory overwrites (assuming these data structures exist) that eventually corrupt the heap.
In any case, I am tracking a potential fix here and will report later if it works long-term: https://github.com/bnicolae/linux-rpi/tree/wpa3
pelwell commentedon Jul 30, 2026
That patch looks good - if it works, I'll happily merge it here.
bnicolae commentedon Jul 31, 2026
The patch did not ultimately help. There is a clear pattern: after exactly 10h of operation, some timer-triggered cleanup is happening. I've also captured some memory contents around the trap:
Further AI analysis reveals the following:
This helper is called from exactly 3 places, all part of a linked-list-of-entries manager (fields at struct offsets 0x430/0x434/0x438: head pointer, active-count byte, etc.) with lookup-by-MAC (memcmp at node+14, length 6) and lookup-by-handle variants, plus a "flush all" variant. The firmware's own string table confirms the subsystem: wlc_scb_cubby_reserve, wlc_scb_attach, and specifically "STA DISASSOC from non-AP SCB" — this is Broadcom's SCB (Station Control Block, the per-connected-client structure), and this code path runs on STA disassociation/removal.
I am documenting this here because Infineon (in particular @gokulkumar-ifx) is working on an upstream patch and it may be helpful to them.
bnicolae commentedon Aug 2, 2026
I finally found the bug. It's in the firmware. After firmware disassembly, here is what I (assisted by my AI :) ) learned:
The firmware uses a PMKID cache that is subject to an expiry mechanism: every entry gets 3600 ticks on creation. A watchdog is triggered every 10 seconds and scrubs the cache (stored as a linked list) and decrements the counter of each entry. After 10h, when the counter becomes 0, the entry is removed from the cache.
The problem is, the watchdog doesn't properly remove an entry if it is in the middle of the list. It calls free on the entry, but it fails to set prev->next = cur->next, as normally is the case with a linked list. Instead, it only readjusts the head if the entry removed is the head (presumably because the head is always assumed to expire first, but that is not the case if the client forces a full SAE and resets the ticks). Thus, on the next watchdog invocation, a stale entry is still in the linked list. This entry has still 0 ticks left, so it is freed again. The double free on the same pointer leads to heap corruption. This is why after a while (precisely after 10 hours) the firmware is crashing.
I have patched the firmware here to properly remove entries from the linked list:
bnicolae/rpi-firmware-nonfree@5e5d95e
However, this should be confirmed, fixed, tested, and distributed by Infineon "officially". @gokulkumar-ifx please have a look. I am happy to keep this issue open and provide more info if needed.
bnicolae commentedon Aug 2, 2026
PS - full disclosure: fixing this issue was part of an AI experiment that aimed to see how far AI can go in autonomously fixing real-life bugs under "difficult" circumstances: complex interactions beyond userspace (kernel, firmware), source code not available or only partially available (in this case firmware is closed-source but kernel is open-source), etc. The experiment was successful, and, as a side-effect, it resulted in a real-life fix that may be helpful to others.
pelwell commentedon Aug 2, 2026
I guessed - we live in interesting times.
bnicolae commentedon Aug 2, 2026
Important observation: this bug is also likely to manifest in STA mode, not just AP mode. It just requires a more specific pattern, like for example, connecting to different WPA3 capable BSSIDs within the same 10h window (which is plausible even in fixed setups where the router offers for example 2.4g and 5g networks at the same time using the same SSID, in which case, a smart client would switch between them freely depending on signal strength, etc). Other examples: roaming between multiple physical APs of the same mesh network, switching between multiple saved WPA3 networks (e.g., home vs. hotspot).
satmandu commentedon Aug 13, 2026
Is there any chance Infineon will release an official fix for this?
I'm also seeing reports of WPA3 issues with STA mode on the OpenWrt forums (which matters to me since I have OpenWrt on a CM4 device).
ValdikSS commentedon Sep 7, 2026
@bnicolae please contact Infineon, they pushed 7.45.286 into linux-firmware official repository just a week ago.
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=a137a09be163c5e3fc6e96ba3bfb9eb328394c34
bnicolae commentedon Sep 7, 2026
This is something @pelwell should to look into, by opening a ticket with Infineon. I am happy to participate with more info if needed.
pelwell commentedon Sep 7, 2026
There is now a ticket for it.
pelwell commentedon Sep 9, 2026
The high level of detail in the bug report, couple with the suggested fix, has meant a very prompt reply from Infineon. You can download a trial build of a firmware including a fix here: https://drive.google.com/file/d/1_2TNb7-E78Bhm49iiwk-6hWpbIUkhb7Q/view?usp=sharing
satmandu commentedon Sep 9, 2026
Any suggestion on how to install this firmware properly on RaspiOS?
This should do the trick, right?
That should give:
Then:
That should work, right?
So before on a current RPI4B I see this:
And after updating the firmware file I see this:
The loaded firmware looks like it is the same version?
(I am not using an initramfs.)
ValdikSS commentedon Sep 9, 2026
pelwell commentedon Sep 9, 2026
cypressshould not be a subdirectory ofbrcm.66 remaining items
colin-kiegel commentedon Oct 17, 2026
I can report a very similar Wi-Fi client-mode failure on a Raspberry Pi 5 running Home Assistant OS 18.3. Several of the kernel messages closely match the [recent Pi 5 client-mode report](#7528 (comment)).
Environment
6.18.39-haos-raspiObserved failure (October 16–17, 2026)
Wi-Fi initially worked normally, but eventually disconnected and failed to reconnect automatically.
NetworkManager reported:
The saved credentials were intact (
psk-flags=0,autoconnect=yes). Initially, manually activating the connection usingnmcli connection up "Supervisor wlan0"restored connectivity without re-entering credentials.After a subsequent outage, manual reconnection also failed, and the kernel reported:
Additional authentication timeouts and firmware-crash messages followed.
Recovery and observations
The behavior and several kernel messages closely resemble the [recent Raspberry Pi 5 client-mode report](#7528 (comment)).
One notable difference is that my installed firmware is 7.45.265, whereas the original issue discusses 7.45.286.
Questions
For now, I'm keeping Ethernet as the production workaround and would prefer to wait for an officially distributed firmware fix rather than manually replacing firmware on the Home Assistant installation.
ValdikSS commentedon Oct 29, 2026
Fixed in
rpi: apply WPA3 firmware cache corruption fix
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported
wifi: brcmfmac: cyw: Only use Infineon external SAE if supported