mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH mt76] wifi: mt76: mt7603: avoid deadlock on failed channel config
@ 2026-11-03  0:22 David Bauer
  0 siblings, 0 replies; only message in thread
From: David Bauer @ 2026-11-03  0:22 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek

The synchronous call to mt7603_mac_work locks the global
mt76 device mutex. This can create a deadlock situation,
as the lock was already taken in mt76_set_channel.

Instead schedule the next mac_work iteration to happen immediately in
case a reset is necessary and perform the reset asynchronously.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 drivers/net/wireless/mediatek/mt76/mt7603/main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
index 757664e9e1f20..61f2461939872 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
@@ -172,9 +172,6 @@ int mt7603_set_channel(struct mt76_phy *mphy)
 	mt7603_mac_set_timing(dev);
 	mt7603_mac_start(dev);
 
-	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
-				     msecs_to_jiffies(MT7603_WATCHDOG_TIME));
-
 	/* reset channel stats */
 	mt76_clear(dev, MT_MIB_CTL, MT_MIB_CTL_READ_CLR_DIS);
 	mt76_set(dev, MT_MIB_CTL,
@@ -191,9 +188,8 @@ int mt7603_set_channel(struct mt76_phy *mphy)
 		mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int);
 
 	tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
-
-	if (failed)
-		mt7603_mac_work(&dev->mphy.mac_work.work);
+	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
+				     failed ? 0 : msecs_to_jiffies(MT7603_WATCHDOG_TIME));
 
 	return ret;
 }
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-03  0:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  0:22 [PATCH mt76] wifi: mt76: mt7603: avoid deadlock on failed channel config David Bauer

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®