Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AE7C38AC72 for ; Mon, 10 Aug 2026 04:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786337647; cv=none; b=oPCbs7jKBcgGasu5P+xatt7tPjDZ63wmNNG2gH1bwtahYHN7SN9kiJI/9eWR7sECRriUzibQx9YV8yJLUW9GwhAwLbNfHagmP7irbupnUGGAUzFIW1VmOBetZrj2ZII6dTMYrstkGlkElYnOs1pAL4ASRCJwrxX7vSHrwnhuAyQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786337647; c=relaxed/simple; bh=EY3NmBWT6rX4G8cLU8WAQY8aBwmqEvgiHUgFxPDmh14=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vGWpZuZDGWVF9NAddR6O6qjG3wXIoo++4prN4TY110jA4wx/UskzCJ6fFRyyAWAqt8efGAA4mrfsKRrqeZvgYfCifndw5mmY6D527PyOIeJPFEFu8aTs5rwxWAomhTViE1RoIwhM0i1CMbm168N/HQSQi19MPzbsU86s0UxhhTE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=justthetip.ca; spf=pass smtp.mailfrom=justthetip.ca; dkim=pass (2048-bit key) header.d=justthetip.ca header.i=@justthetip.ca header.b=foOvnZKg; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=justthetip.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=justthetip.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=justthetip.ca header.i=@justthetip.ca header.b="foOvnZKg" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=justthetip.ca; s=key1; t=1786337640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tIejKVdJ5f9l9V+gM9JKEr6hyxVA4B5zV7tAh4ot/R8=; b=foOvnZKgHs27wI3z77g7WH2RrxzQ6Mp57s9IReQuuyOhXmFC4MmwzgXxn8LL03j4S9eE6h ZfDyA6E8CidcIoEpm2Wod2H9wHJNwwkpb97dG2cb293+NcyXhuhPYqwC8+vfus186cVuTA h3gItTXewKEqUil5PFKmrtMrQgXY7cekGhkDkBD/2Y2fQdNFydI0cd2bUdgT0E8S7eie1g x/avyyLVILbMnVsuqRkpgALboySG6bm1qyNNue44aLanW4dRm2vE7QVyNnqF+19M/DxsOM FCVkDplOHZxDO7HQJt90mug0EkYTFb0tpag4lPsWAUhzakXd//JeYks5KKmkUA== From: Devin Wittmayer To: Felix Fietkau , Lorenzo Bianconi Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, Ryder Lee , Shayne Chen , Sean Wang , Deren Wu , Johannes Berg Subject: [PATCH wireless 1/2] wifi: mt76: mt7921: fix lock inversion between dev->mutex and iflist_mtx Date: Sun, 9 Aug 2026 21:53:37 -0700 Message-ID: <20260810045338.118923-2-lucid_duck@justthetip.ca> In-Reply-To: <20260810045338.118923-1-lucid_duck@justthetip.ca> References: <20260810045338.118923-1-lucid_duck@justthetip.ca> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT mt7921_config() holds dev->mutex across ieee80211_iterate_active_interfaces(), which takes local->iflist_mtx. mac80211 uses the opposite order: ieee80211_del_virtual_monitor() holds iflist_mtx while calling drv_unassign_vif_chanctx(), and mt792x_unassign_vif_chanctx() takes dev->mutex. Deleting a monitor interface that has a channel assigned reaches the second order and lockdep reports the cycle. The driver side of it: -> #1 (&local->iflist_mtx){+.+.}-{4:4}: __mutex_lock+0xda/0x1070 ieee80211_iterate_interfaces+0x34/0x70 [mac80211] mt7921_config+0xb8/0xe0 [mt7921_common] drv_config+0x63/0x1d0 [mac80211] .config is only reached through drv_config(), which asserts the wiphy mutex, so ieee80211_iterate_active_interfaces_mtx() can be used. It walks the same list under the wiphy mutex and never takes iflist_mtx, which drops the driver's dev->mutex -> iflist_mtx edge. Fixes: cbaa0a404f8d ("mt76: mt7921: fix up the monitor mode") Link: https://lore.kernel.org/linux-wireless/20260730053916.109426-1-lucid_duck@justthetip.ca/ Signed-off-by: Devin Wittmayer --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 3480205d5fb9..a3d06992cc17 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -652,9 +652,9 @@ static int mt7921_config(struct ieee80211_hw *hw, int radio_idx, u32 changed) } if (changed & IEEE80211_CONF_CHANGE_MONITOR) { - ieee80211_iterate_active_interfaces(hw, - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_sniffer_interface_iter, dev); + ieee80211_iterate_active_interfaces_mtx(hw, + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_sniffer_interface_iter, dev); } out: -- 2.55.0