mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH wireless 0/1] wifi: brcmfmac: fix oops on removal while wpa_supplicant exits
@ 2026-09-24 12:30 Michele Dionisio
  2026-09-24 12:30 ` [PATCH wireless 1/1] wifi: brcmfmac: fix P2P device removal race in brcmf_detach() Michele Dionisio
  0 siblings, 1 reply; 2+ messages in thread
From: Michele Dionisio @ 2026-09-24 12:30 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Michele Dionisio, Hante Meuleman, Fan Wu, Kalle Valo,
	Pieter-Paul Giesberts, linux-wireless, brcm80211,
	brcm80211-dev-list.pdl, linux-kernel

Unloading brcmfmac while wpa_supplicant is still exiting crashes the
kernel in _cfg80211_unregister_wdev(). The P2P device interface is
removed twice: once by NL80211_CMD_DEL_INTERFACE (brcmf_p2p_del_vif())
and once by brcmf_detach(), which reads ifp->vif before blocking on
rtnl_lock() and then uses it after the other path has freed it.

I hit this on an i.MX 8M Plus board with a CYW55513 (Sona IF513) on
SDIO, running the Ezurio backport of brcmfmac from v6.18.22 on a 5.4-rt
kernel. The code involved is unchanged in mainline. It reproduces with:

  kill $(pidof wpa_supplicant); rmmod brcmfmac_cyw brcmfmac

The patch takes RTNL and the wiphy mutex in brcmf_detach() before
removing the interface that has no netdev, and re-reads iflist under
them.

Testing: on mainline the patch is build tested only (W=1, no warnings).
I tested the same change on the board above, applied to the Ezurio
backport of brcmfmac (from v6.18.22) running on the 5.4-rt kernel: with
the patch the reproducer no longer crashes the kernel. I am not able to
test a mainline kernel on that board.

The analysis of the oops and the patch were done with the help of an
AI assistant (Claude), from the oops, the driver debug log (debug=0x406)
and the driver sources. I reviewed the change and I can answer
questions about it.

Michele Dionisio (1):
  wifi: brcmfmac: fix P2P device removal race in brcmf_detach()

 .../broadcom/brcm80211/brcmfmac/core.c        | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)


base-commit: 93f51579e7df248780214094418f205253383cc5
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-24 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 12:30 [PATCH wireless 0/1] wifi: brcmfmac: fix oops on removal while wpa_supplicant exits Michele Dionisio
2026-09-24 12:30 ` [PATCH wireless 1/1] wifi: brcmfmac: fix P2P device removal race in brcmf_detach() Michele Dionisio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®