Skip to content

brcmfmac: fix firmware crash due to mismatched completion handlers#7460

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
bnicolae:rpi-6.18.y
Jun 29, 2026
Merged

brcmfmac: fix firmware crash due to mismatched completion handlers#7460
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
bnicolae:rpi-6.18.y

Conversation

@bnicolae

@bnicolae bnicolae commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Without a valid cookie to distinguish pending concurrent completion events, mismatches occur under concurrency that crash the firmware. The cookie is used to populate mf_params->packet_id and is sent to firmware via vif->mgmt_tx_id. Later, completions are matched using if (packet_id != vif->mgmt_tx_id). This fix uses a monotonous atomic counter that guarantees unique ids.

Without a valid cookie to distinguish pending concurrent completion
events, mismatches occur under concurrency that crash the firmware.
This fix uses a monotonous atomic counter that guarantees unique ids.

Signed-off-by: Bogdan Nicolae <bogdan.nicolae@acm.org>
@pelwell

pelwell commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

I can see how that might make a difference, but also it doesn't look as if it could break anything.

@pelwell pelwell merged commit d3d330f into raspberrypi:rpi-6.18.y Jun 29, 2026
12 checks passed
@lategoodbye

Copy link
Copy Markdown
Contributor

@bnicolae Could you please send this patch upstream?

@bnicolae

Copy link
Copy Markdown
Contributor Author

Sure, happy to, but let me investigate and test some more. I'm not sure we really need to set the cookie anyway, maybe using the counter for params->packet_id directly works just fine. I used the cookie because the Infineon backports use it too (but in a hacky way, they set the cookie to a pointer, which is not deferenced anyhere, but a reallocation could regenerate the same pointer, therefore at risk of not being unique). If the cookie is not used upstream, then setting params->packet_id is cleaner.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 1, 2026
kernel: usb: dwc2: gadget: Demote stall-related messages
See: raspberrypi/linux#7453

kernel: brcmfmac: PMKID needs to be passed to firmware if present
See: raspberrypi/linux#7455

kernel: regulator: edatec-panel-regulator: Fix backlight power state restoration
See: raspberrypi/linux#7457

kernel: overlays: Add Sixfab M1M PCIe Gen3 AI HAT+
See: raspberrypi/linux#7454

kernel: brcmfmac: fix firmware crash due to mismatched completion handlers
See: raspberrypi/linux#7460

kernel: spi: dw: Fix duplicate if block in dw_spi_transfer_one
See: raspberrypi/linux#7465

kernel: r8152: add vendor/device ID for CoreChips SR9900
See: raspberrypi/linux#7437
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Jul 1, 2026
kernel: usb: dwc2: gadget: Demote stall-related messages
See: raspberrypi/linux#7453

kernel: brcmfmac: PMKID needs to be passed to firmware if present
See: raspberrypi/linux#7455

kernel: regulator: edatec-panel-regulator: Fix backlight power state restoration
See: raspberrypi/linux#7457

kernel: overlays: Add Sixfab M1M PCIe Gen3 AI HAT+
See: raspberrypi/linux#7454

kernel: brcmfmac: fix firmware crash due to mismatched completion handlers
See: raspberrypi/linux#7460

kernel: spi: dw: Fix duplicate if block in dw_spi_transfer_one
See: raspberrypi/linux#7465

kernel: r8152: add vendor/device ID for CoreChips SR9900
See: raspberrypi/linux#7437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants