Skip to contentSkip to conversation

brcmfmac: p2p: Fix recently introduced deadlock issue

PATCH RESEND In review Hans de Goede 2 participants 5 messages Apr 5, 2021 – Apr 6, 2021 1 message not in the archive Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

cover brcmfmac: p2p: Fix recently introduced deadlock issue

Hi,

Here is a resend of a regression/deadlock fix for 5.12 which I send out around rc1 but which still is not in Linus' tree.

This is quite a bad bug, breaking things for most broadcom wifi users.

Can we get this regression fix on its way to Linus for 5.12-rc7 ASAP please ?

Regards,

Hans

Hans de Goede (1):
brcmfmac: p2p: Fix recently introduced deadlock issue

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH RESEND 1/1 brcmfmac: p2p: Fix recently introduced deadlock issue

Commit a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") replaced the rtnl_lock parameter passed to various brcmf functions with just lock, because since that commit it is not just about the rtnl_lock but also about the wiphy_lock .

During this search/replace the "if (!rtnl_locked)" check in brcmfmac/p2p.c was accidentally replaced with "if (locked)", dropping the inversion of the check. This causes the code to now call rtnl_lock() while already holding the lock, causing a deadlock.

Add back the "!" to the if-condition to fix this.

Cc Johannes Berg <[email protected]>
Fixes a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +1 -1
index 6d30a0fcecea..34cd8a7401fe 100644
@@ -2439,7 +2439,7 @@ void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool locked)
 	vif = ifp->vif;
 	cfg = wdev_to_cfg(&vif->wdev);
 	cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
-	if (locked) {
+	if (!locked) {
 		rtnl_lock();
 		wiphy_lock(cfg->wiphy);
 		cfg80211_unregister_wdev(&vif->wdev);
Signature · 1 line
2.30.2
#2 lore raw
Quoted 10 lines · Hans de Goede

Commit a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") replaced the rtnl_lock parameter passed to various brcmf functions with just lock, because since that commit it is not just about the rtnl_lock but also about the wiphy_lock .

During this search/replace the "if (!rtnl_locked)" check in brcmfmac/p2p.c was accidentally replaced with "if (locked)", dropping the inversion of the check. This causes the code to now call rtnl_lock() while already holding the lock, causing a deadlock.

Quoted 5 lines

Add back the "!" to the if-condition to fix this.

Cc Johannes Berg <[email protected]>
Fixes a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")

This is already applied:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git/commit/?id=bd83a2fc05ed323d7ae38443a6d2e253ef1c4237

Patch set to Superseded.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi,

Quoted 14 lines · Kalle Valo
Quoted 12 lines · Hans de Goede

Commit a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") replaced the rtnl_lock parameter passed to various brcmf functions with just lock, because since that commit it is not just about the rtnl_lock but also about the wiphy_lock .

During this search/replace the "if (!rtnl_locked)" check in brcmfmac/p2p.c was accidentally replaced with "if (locked)", dropping the inversion of the check. This causes the code to now call rtnl_lock() while already holding the lock, causing a deadlock.

Add back the "!" to the if-condition to fix this.

Quoted 7 lines
Quoted 3 lines
Cc Johannes Berg <[email protected]>
Fixes a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")

This is already applied:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git/commit/?id=bd83a2fc05ed323d7ae38443a6d2e253ef1c4237

But it is not yet in 5.12-rc6, even though this is a regression fix for a regression introduced in 5.12. What is the plan to get this into 5.12 ?

Regards,

Hans

#5 lore raw
In reply to Hans de Goede
Quoted 9 lines · Hans de Goede

Hi,

Here is a resend of a regression/deadlock fix for 5.12 which I send out around rc1 but which still is not in Linus' tree.

This is quite a bad bug, breaking things for most broadcom wifi users.

Can we get this regression fix on its way to Linus for 5.12-rc7 ASAP please ?

The patch has been already applied but I have not yet sent a pull request, the plan is to send it later this week.

Please don't resend patches which have been already applied, that creates more work for me.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches