Skip to content

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions