wifi: brcmfmac: fix oops on removal while wpa_supplicant exits
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | wifi: brcmfmac: fix P2P device removal race in brcmf_detach()drivers/ | +25 | 1 reply |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Arend van Spriel |
|---|---|
| 1/1 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH wireless 0/1] wifi: brcmfmac: fix oops on removal while wpa_supplicant exits
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
Signature · 1 line
2.53.0