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.

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