diff mbox series

[RFC] brcmfmac: don't take RTNL if already locked

Message ID 20210426212905.6b0f78581429.I2ee37448e499091b3ec0b23d642e3113ef670a8e@changeid
State New
Headers show
Series [RFC] brcmfmac: don't take RTNL if already locked | expand

Commit Message

Johannes Berg April 26, 2021, 7:29 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

We should not take the RTNL if we come here already with the
RTNL held, so don't take it again.

The Fixes tag below might not be completely accurate, that
might just have made the problem obvious by showing that the
function can be called with RTNL already held.

Fixes: b50ddfa8530e ("brcmfmac: fix lockup when removing P2P interface after event timeout")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index ea78fe527c5d..ce9d8781b62b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -926,9 +926,11 @@  static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
 	if (ifp->ndev) {
 		if (bsscfgidx == 0) {
 			if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
-				rtnl_lock();
+				if (!locked)
+					rtnl_lock();
 				brcmf_netdev_stop(ifp->ndev);
-				rtnl_unlock();
+				if (!locked)
+					rtnl_unlock();
 			}
 		} else {
 			netif_stop_queue(ifp->ndev);