Skip to content

wifi: brcmfmac: firmware crash when using WPA3/SAE #7528

Open

Description

@bnicolae

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

  1. bnicolae commented on Jul 30, 2026

    @bnicolae
    ContributorAuthor

    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

  2. pelwell commented on Jul 30, 2026

    @pelwell
    Contributor

    That patch looks good - if it works, I'll happily merge it here.

  3. bnicolae commented on Jul 31, 2026

    @bnicolae
    ContributorAuthor

    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:

    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 cpsr 0x0000019f spsr 0x000001bf
                                         pc 0x0019a330 lr 0x0019a30d sp 0x0025ff20 ip 0x00000000 fp 0x11cf8869
                                         r0 0x002036d8 r1 0x99b83efa r2 0x99b83ef1 r3 0x00203e98
                                         r4 0x00000001 r5 0x00000009 r6 0x00000000 r7 0x00198718
                                         r8 0x18002000 r9 0x18102000 r10 0x221b3981
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem: dump_trap: memory at r0=0x002036d8:
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x00: 00 00 00 00 98 3e 20 00 0c 8d 04 00 29 ef 01 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x10: 54 aa 25 00 6c ff 25 00 00 00 00 00 00 00 00 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x20: 00 00 00 00 01 00 00 00 01 04 00 00 c8 fe 25 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x30: 00 00 00 00 00 00 00 00 00 00 00 00 bc de 25 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem: dump_trap: memory at sp=0x0025ff20:
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x00: f8 9d 25 00 44 8d 21 00 00 00 00 00 fb 91 1c 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x10: f8 9d 25 00 44 8d 21 00 90 78 24 00 39 93 1c 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x20: 44 57 24 00 00 00 00 00 0c 87 19 00 21 f6 01 00
    kernel: brcmfmac: brcmf_sdio_dump_trap_mem:   +0x30: 19 f6 01 00 43 7f 00 00 19 7f 00 00 30 da 25 00
    kernel: ieee80211 phy0: brcmf_fw_crashed: Firmware has halted or crashed
    

    Further AI analysis reveals the following:

    free()'s saved LR in trap #5's stack dump is 0x001c91fb — Tracing that address:
    0x1c91e8: push {r3,r4,r5,lr}
              cbz r1, +end                  ; if (obj == NULL) return
              r0 = *(obj + 0)               ; <-- the value that becomes free()'s argument
              *(obj + 20) = 0
              if (r0 != 0) bl free(r0)      ; <-- CRASHES HERE in both traps: obj->field_0 held 7 or 9
              *(obj + 0) = 0
              *(obj + 8) = 0
              r0 = obj
              [restore lr] tail-call free(obj)   ; then frees the container itself
    

    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.

  4. bnicolae commented on Aug 2, 2026

    @bnicolae
    ContributorAuthor

    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.

  5. bnicolae commented on Aug 2, 2026

    @bnicolae
    ContributorAuthor

    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.

  6. pelwell commented on Aug 2, 2026

    @pelwell
    Contributor

    I guessed - we live in interesting times.

  7. bnicolae commented on Aug 2, 2026

    @bnicolae
    ContributorAuthor

    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).

  8. satmandu commented on Aug 13, 2026

    @satmandu

    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).

  9. ValdikSS commented on Sep 7, 2026

    @ValdikSS
    Contributor

    @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

  10. bnicolae commented on Sep 7, 2026

    @bnicolae
    ContributorAuthor

    This is something @pelwell should to look into, by opening a ticket with Infineon. I am happy to participate with more info if needed.

  11. pelwell commented on Sep 7, 2026

    @pelwell
    Contributor

    There is now a ticket for it.

  12. pelwell commented on Sep 9, 2026

    @pelwell
    Contributor

    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

  13. satmandu commented on Sep 9, 2026

    @satmandu

    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

    Any suggestion on how to install this firmware properly on RaspiOS?
    This should do the trick, right?

    curl "https://drive.usercontent.google.com/download?id={1_2TNb7-E78Bhm49iiwk-6hWpbIUkhb7Q}&confirm=xxx" -o cyfmac43455-sdio_pmkid_expire_fix_testonly.bin
    sha256sum cyfmac43455-sdio_pmkid_expire_fix_testonly.bin
    

    That should give:

    92f91d59f463f2597d8891e1c7ae870d60e4188ce9ce3c8ca1016ba07da39ee5  cyfmac43455-sdio_pmkid_expire_fix_testonly.bin
    

    Then:

    sudo mv cyfmac43455-sdio_pmkid_expire_fix_testonly.bin /lib/firmware/cypress/
    cd /lib/firmware/brcm
    sudo ln -sf ./cypress/cyfmac43455-sdio_pmkid_expire_fix_testonly.bin brcmfmac43455-sdio.bin
    sudo reboot
    

    That should work, right?

    So before on a current RPI4B I see this:

    sudo dmesg | grep brcm
    [    0.646195] irq_brcmstb_l2: registered L2 intc (/soc/interrupt-controller@7ef00100, parent irq: 23)
    [    0.650987] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
    [    0.651014] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x063fffffff -> 0x00c0000000
    [    0.651035] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00bfffffff -> 0x0400000000
    [    0.651769] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
    [    0.753754] brcm-pcie fd500000.pcie: clkreq-mode set to default
    [    0.755816] brcm-pcie fd500000.pcie: link up, 5.0 GT/s PCIe x1 (SSC)
    [   17.914781] brcmstb-i2c fef04500.i2c:  @97500hz registered in polling mode
    [   17.989974] brcmstb-i2c fef09500.i2c:  @97500hz registered in polling mode
    [   18.347500] brcmfmac: F1 signature read @0x18000000=0x15264345
    [   18.351663] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
    [   18.571447] usbcore: registered new interface driver brcmfmac
    [   18.615961] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
    [   18.616489] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Aug 29 2023 01:47:08 version 7.45.265 (28bca26 CY) FWID 01-b677b91b
    [   22.662144] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
    

    And after updating the firmware file I see this:

    sudo dmesg | grep brcm
    [    0.646522] irq_brcmstb_l2: registered L2 intc (/soc/interrupt-controller@7ef00100, parent irq: 23)
    [    0.651364] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
    [    0.651392] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x063fffffff -> 0x00c0000000
    [    0.651413] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00bfffffff -> 0x0400000000
    [    0.652146] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
    [    0.757785] brcm-pcie fd500000.pcie: clkreq-mode set to default
    [    0.759846] brcm-pcie fd500000.pcie: link up, 5.0 GT/s PCIe x1 (SSC)
    [   17.990298] brcmstb-i2c fef04500.i2c:  @97500hz registered in polling mode
    [   17.996272] brcmstb-i2c fef09500.i2c:  @97500hz registered in polling mode
    [   18.254536] brcmfmac: F1 signature read @0x18000000=0x15264345
    [   18.266557] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
    [   18.273937] usbcore: registered new interface driver brcmfmac
    [   18.483172] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
    [   18.483648] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Aug 29 2023 01:47:08 version 7.45.265 (28bca26 CY) FWID 01-b677b91b
    [   22.688740] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
    

    The loaded firmware looks like it is the same version?

    (I am not using an initramfs.)

  14. ValdikSS commented on Sep 9, 2026

    @ValdikSS
    Contributor
    mv /lib/firmware/cypress/cyfmac43455-sdio.bin{,_}
    cp cyfmac43455-sdio_pmkid_expire_fix_testonly.bin /lib/firmware/cypress/cyfmac43455-sdio.bin
    ``
    
  15. pelwell commented on Sep 9, 2026

    @pelwell
    Contributor
    sudo mv cyfmac43455-sdio_pmkid_expire_fix_testonly.bin /lib/firmware/cypress/
    cd /lib/firmware/brcm
    sudo ln -sf ./cypress/cyfmac43455-sdio_pmkid_expire_fix_testonly.bin brcmfmac43455-sdio.bin
    sudo reboot
    

    cypress should not be a subdirectory of brcm.

  16. 66 remaining items

  17. colin-kiegel commented on Oct 17, 2026

    @colin-kiegel

    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

    • Hardware: Raspberry Pi 5, integrated Broadcom/Cypress Wi-Fi
    • OS: Home Assistant OS 18.3
    • Kernel: 6.18.39-haos-raspi
    • Wi-Fi firmware: BCM4345/6, version 7.45.265 (Aug 29, 2023)
    • Access point: FRITZ!Box 7590 AX with FRITZ! Mesh repeaters
    • Security: WPA2/WPA3 transition mode
    • The authentication method actually negotiated by the client (WPA2/PSK or WPA3/SAE) has not been verified.

    Observed failure (October 16–17, 2026)

    Wi-Fi initially worked normally, but eventually disconnected and failed to reconnect automatically.

    NetworkManager reported:

    association took too long
    state change: config -> failed (reason 'no-secrets')
    Activation: failed for connection 'Supervisor wlan0'
    

    The saved credentials were intact (psk-flags=0, autoconnect=yes). Initially, manually activating the connection using nmcli connection up "Supervisor wlan0" restored connectivity without re-entering credentials.

    After a subsequent outage, manual reconnection also failed, and the kernel reported:

    brcmf_cyw_mgmt_tx: TX Auth frame operation is timeout: status=8
    brcmf_cyw_external_auth: External authentication failed: status=1
    brcmf_cyw_mgmt_tx: TX Auth frame operation is failed: status=10
    brcmf_fw_crashed: Firmware has halted or crashed
    brcmf_sdio_bus_rxctl: resumed on timeout
    brcmf_sdio_checkdied: firmware trap in dongle
    brcmf_cyw_mgmt_tx: Failed to send Auth frame: err=-110
    brcmf_fil_cmd_data: bus is down. we have nothing to do.
    

    Additional authentication timeouts and firmware-crash messages followed.

    Recovery and observations

    • A full host reboot restored Wi-Fi operation.
    • Ethernet works reliably and is now the primary connection.
    • The surrounding FRITZ! Mesh experienced separate instability, including repeated repeater disconnections and PMF authentication failures.
    • Rebooting the FRITZ!Box restored normal network performance, but did not prevent the Raspberry Pi's subsequent Wi-Fi failure.
    • The relationship between the Mesh instability, authentication errors, and firmware crash remains unknown.

    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

    1. Could this be another manifestation of the firmware issue discussed here, despite the older firmware version and client-mode operation?
    2. Are the upcoming Infineon firmware fixes expected to address client-mode authentication failures and firmware crashes as well?
    3. Is there any additional diagnostic information worth collecting during the next occurrence?

    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.

  18. ValdikSS commented on Oct 29, 2026

    @ValdikSS
    Contributor

    41. UPD: Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1147955

    Fixed in

    wpa (2:2.11-5) unstable; urgency=medium
    
       * Fix SIGSEGV in AP mode on any received DPP chirp (Closes: #1149027)
       * Fix SAE reporting over D-Bus (Closes: #1147955)
       * Disable MAC randomization during P2P provisioning.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions