Commit bd83a2fc authored by Hans de Goede's avatar Hans de Goede Committed by Kalle Valo

brcmfmac: p2p: Fix recently introduced deadlock issue

Commit a05829a7 ("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 <johannes.berg@intel.com>
Fixes: a05829a7 ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210313143635.109154-1-hdegoede@redhat.com
parent 8f6a70fd
...@@ -2439,7 +2439,7 @@ void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool locked) ...@@ -2439,7 +2439,7 @@ void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool locked)
vif = ifp->vif; vif = ifp->vif;
cfg = wdev_to_cfg(&vif->wdev); cfg = wdev_to_cfg(&vif->wdev);
cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
if (locked) { if (!locked) {
rtnl_lock(); rtnl_lock();
wiphy_lock(cfg->wiphy); wiphy_lock(cfg->wiphy);
cfg80211_unregister_wdev(&vif->wdev); cfg80211_unregister_wdev(&vif->wdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment