* [stable request] mt7921e: backport two mt76 fixes to 6.12.y
@ 2026-06-10 8:09 Ajrat Makhmutov
2026-06-11 0:45 ` Sasha Levin
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Ajrat Makhmutov @ 2026-06-10 8:09 UTC (permalink / raw)
To: stable
Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
Sean Wang, linux-wireless
Hi,
Please consider backporting the following two upstream commits to the
6.12.y stable tree. Both are in Linus' tree and both cherry-pick cleanly
onto 6.12.y:
2425dc7beaadc ("wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain")
5ed54896b6bd4 ("wifi: mt76: mt7921: fix a potential scan no APs")
Together they fix a hard-to-reproduce MT7921e (MT7921 PCIe) lockup we have
been tracking on ALT Linux: after a disconnect (signal loss / AP deauth) or
repeated reconnects the chip ends up in a wrong firmware state and stops
scanning/associating to any network, recoverable only by a chip reset or a
module reload. The symptom is reproducible on 6.12.y and gone on 7.1. We
could not bisect the symptom to a single upstream commit, but these two are
the relevant fixes on the mt7921e path:
- 5ed54896b6bd4 aborts the granted ROC channel before station removal, so
the firmware is not left in a wrong state that makes subsequent scans
return no APs.
- 2425dc7beaadc stops a connected AP's country IE from re-triggering
regulatory/CLC reprogramming once the user has already set a regdomain,
which we observed leaving the firmware power/regulatory tables in a bad
state.
Neither commit carries a Cc: stable tag, which is why they were not picked
up automatically.
Both have been tested on real MT7921e hardware (Acer Aspire 5 A517-52,
ASUS VivoBook S14, Lenovo IdeaPad Slim 5 14AHP9) running the 6.12 kernel.
BugLink: https://bugzilla.altlinux.org/54853
Thanks,
Ajrat Makhmutov
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [stable request] mt7921e: backport two mt76 fixes to 6.12.y 2026-06-10 8:09 [stable request] mt7921e: backport two mt76 fixes to 6.12.y Ajrat Makhmutov @ 2026-06-11 0:45 ` Sasha Levin 2026-06-11 10:38 ` Ajrat Makhmutov 2026-06-16 13:21 ` Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2 siblings, 2 replies; 15+ messages in thread From: Sasha Levin @ 2026-06-11 0:45 UTC (permalink / raw) To: stable Cc: Sasha Levin, Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang, linux-wireless, Ajrat Makhmutov On Tue, Jun 10, 2026 at 11:09:43AM +0300, Ajrat Makhmutov wrote: > Please backport to 6.12.y: > 2425dc7beaad wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain > 5ed54896b6bd wifi: mt76: mt7921: fix a potential scan no APs I'm going to hold off on this one. The second commit, 5ed54896b6bd, introduces a reachable dev->mutex self-deadlock on STA-remove-while-ROC; the follow-up that cures it (d5059e52) isn't in any stable tree and was never marked for stable (it's only in linux-next so far). So taking these two alone would queue a deadlock. If d5059e52 lands upstream (or you can confirm it's headed to stable), please resend the request as all three together and I'll take them for 6.12.y. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [stable request] mt7921e: backport two mt76 fixes to 6.12.y 2026-06-11 0:45 ` Sasha Levin @ 2026-06-11 10:38 ` Ajrat Makhmutov 2026-06-16 13:21 ` Ajrat Makhmutov 1 sibling, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-11 10:38 UTC (permalink / raw) To: Sasha Levin, stable Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang, linux-wireless Hi Sasha, > I'm going to hold off on this one. The second commit, 5ed54896b6bd, > introduces a reachable dev->mutex self-deadlock on STA-remove-while-ROC; > the follow-up that cures it (d5059e52) isn't in any stable tree and was > never marked for stable (it's only in linux-next so far). Thanks, and good catch. I'll resend the request for all three together as soon as it lands in Linus' tree. Note for whenever it does: when applied to 6.12.y, d5059e52 needs one trivial change - keep del_timer_sync() instead of timer_delete_sync(), as the timer API rename is not present in 6.12.y. Thanks, Ajrat ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [stable request] mt7921e: backport two mt76 fixes to 6.12.y 2026-06-11 0:45 ` Sasha Levin 2026-06-11 10:38 ` Ajrat Makhmutov @ 2026-06-16 13:21 ` Ajrat Makhmutov 2026-06-19 4:06 ` Sasha Levin 1 sibling, 1 reply; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-16 13:21 UTC (permalink / raw) To: Sasha Levin, stable Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang, linux-wireless Hi Sasha, > So taking these two alone would queue a deadlock. If d5059e52 lands > upstream (or you can confirm it's headed to stable), please resend the > request as all three together and I'll take them for 6.12.y. d5059e52 is in mainline - it's already in v7.1-rc6, not just linux-next - so here is the full set; please apply all three to 6.12.y together: 2425dc7beaadc ("wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain") 5ed54896b6bd4 ("wifi: mt76: mt7921: fix a potential scan no APs") d5059e52fd8bc ("wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync") One note for the 6.12.y backport of d5059e52: keep del_timer_sync() instead of timer_delete_sync() - the timer API rename is not present in 6.12.y. The other two cherry-pick cleanly. Tested together on real MT7921e hardware (Acer Aspire 5 A517-52, ASUS VivoBook S14, Lenovo IdeaPad Slim 5 14AHP9) on 6.12. Thanks, Ajrat ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [stable request] mt7921e: backport two mt76 fixes to 6.12.y 2026-06-16 13:21 ` Ajrat Makhmutov @ 2026-06-19 4:06 ` Sasha Levin 0 siblings, 0 replies; 15+ messages in thread From: Sasha Levin @ 2026-06-19 4:06 UTC (permalink / raw) To: Sasha Levin, stable Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang, linux-wireless, Ajrat Makhmutov > Please backport the following mt76/mt7921 fixes to 6.12.y: > - avoid undesired changes of the preset regulatory domain > - fix a potential scan no APs > - fix potential deadlock in mt7921_roc_abort_sync All three are now queued for 6.12, thanks. The roc_abort_sync fix was adapted to keep del_timer_sync(), since the timer rename is absent in 6.12. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain 2026-06-10 8:09 [stable request] mt7921e: backport two mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-11 0:45 ` Sasha Levin @ 2026-06-17 12:57 ` Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2 siblings, 2 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 12:57 UTC (permalink / raw) To: stable Cc: 'Sasha Levin ', Leon Yen, Ming Yen Hsieh, David Ruth, Felix Fietkau From: Leon Yen <leon.yen@mediatek.com> commit 2425dc7beaadc39c2636f97f8bdc22dc3cf88149 upstream. Some countries have strict RF restrictions where changing the regulatory domain dynamically based on the connected AP is not acceptable. This patch disables Beacon country IE hinting when a valid country code is set from usersland (e.g., by system using iw or CRDA). Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 2425dc7beaadc39c2636f97f8bdc22dc3cf88149) --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 4bd533c4ba9a1..276dfb9c26e0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -137,6 +137,13 @@ mt7921_regd_notifier(struct wiphy *wiphy, dev->mt76.region = request->dfs_region; dev->country_ie_env = request->country_ie_env; + if (request->initiator == NL80211_REGDOM_SET_BY_USER) { + if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0') + wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; + else + wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; + } + if (pm->suspended) return; -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/3] wifi: mt76: mt7921: fix a potential scan no APs 2026-06-17 12:57 ` [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov @ 2026-06-17 12:57 ` Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 1 sibling, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 12:57 UTC (permalink / raw) To: stable Cc: 'Sasha Levin ', Quan Zhou, Sean Wang, David Ruth, Felix Fietkau From: Quan Zhou <quan.zhou@mediatek.com> commit 5ed54896b6bd444223092cab361b0785932119ab upstream. In multi-channel scenarios, the granted channel must be aborted before station remove. Otherwise, the firmware will be put into a wrong state, resulting in have chance to make subsequence scan no APs. With this patch, the granted channel will be always aborted before station remove. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Reviewed-by: Sean Wang <sean.wang@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Reviewed-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/1ac1ae779db86d4012199a24ea2ca74050ed4af6.1721300411.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 5ed54896b6bd444223092cab361b0785932119ab) --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index a93ae4e44f16a..f2fffca868b51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -368,9 +368,9 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) del_timer_sync(&phy->roc_timer); cancel_work_sync(&phy->roc_work); if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_active_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); @@ -881,6 +881,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + mt7921_roc_abort_sync(dev); mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync 2026-06-17 12:57 ` [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov @ 2026-06-17 12:57 ` Ajrat Makhmutov 1 sibling, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 12:57 UTC (permalink / raw) To: stable; +Cc: 'Sasha Levin ', Sean Wang, Quan Zhou, Felix Fietkau From: Sean Wang <sean.wang@mediatek.com> commit d5059e52fd8bc624ec4255c9fa01a266513d126b upstream. roc_abort_sync() can deadlock with roc_work(). roc_work() holds dev->mt76.mutex, while cancel_work_sync() waits for roc_work() to finish. If the caller already owns the same mutex, both sides block and no progress is possible. This deadlock can occur during station removal when mt76_sta_state() -> mt76_sta_remove() -> mt7921_mac_sta_remove() -> mt7921_roc_abort_sync() invokes cancel_work_sync() while roc_work() is still running and holding dev->mt76.mutex. This avoids the mutex deadlock and preserves exactly-once work ownership. Fixes: 352d966126e6 ("wifi: mt76: mt7921: fix a potential association failure upon resuming") Co-developed-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20260126180013.8167-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit d5059e52fd8bc624ec4255c9fa01a266513d126b) [ALT: keep del_timer_sync() instead of timer_delete_sync() — the timer API rename is not present in 6.12.y. ] --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index f2fffca868b51..99561094640f1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -365,12 +365,15 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) { struct mt792x_phy *phy = &dev->phy; + if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) + return; + del_timer_sync(&phy->roc_timer); - cancel_work_sync(&phy->roc_work); - if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + cancel_work(&phy->roc_work); + + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain 2026-06-10 8:09 [stable request] mt7921e: backport two mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-11 0:45 ` Sasha Levin 2026-06-17 12:57 ` [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov @ 2026-06-17 13:08 ` Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov ` (2 more replies) 2 siblings, 3 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 13:08 UTC (permalink / raw) To: stable Cc: sashal, Leon Yen, Ming Yen Hsieh, David Ruth, Felix Fietkau, Ajrat Makhmutov From: Leon Yen <leon.yen@mediatek.com> commit 2425dc7beaadc39c2636f97f8bdc22dc3cf88149 upstream. Some countries have strict RF restrictions where changing the regulatory domain dynamically based on the connected AP is not acceptable. This patch disables Beacon country IE hinting when a valid country code is set from usersland (e.g., by system using iw or CRDA). Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; add backporter Signed-off-by. No code change. drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 4bd533c4ba9a1..276dfb9c26e0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -137,6 +137,13 @@ mt7921_regd_notifier(struct wiphy *wiphy, dev->mt76.region = request->dfs_region; dev->country_ie_env = request->country_ie_env; + if (request->initiator == NL80211_REGDOM_SET_BY_USER) { + if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0') + wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; + else + wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; + } + if (pm->suspended) return; -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/3] wifi: mt76: mt7921: fix a potential scan no APs 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov @ 2026-06-17 13:08 ` Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov 2 siblings, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 13:08 UTC (permalink / raw) To: stable Cc: sashal, Quan Zhou, Sean Wang, David Ruth, Felix Fietkau, Ajrat Makhmutov From: Quan Zhou <quan.zhou@mediatek.com> commit 5ed54896b6bd444223092cab361b0785932119ab upstream. In multi-channel scenarios, the granted channel must be aborted before station remove. Otherwise, the firmware will be put into a wrong state, resulting in have chance to make subsequence scan no APs. With this patch, the granted channel will be always aborted before station remove. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Reviewed-by: Sean Wang <sean.wang@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Reviewed-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/1ac1ae779db86d4012199a24ea2ca74050ed4af6.1721300411.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; add backporter Signed-off-by. No code change. drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index a93ae4e44f16a..f2fffca868b51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -368,9 +368,9 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) del_timer_sync(&phy->roc_timer); cancel_work_sync(&phy->roc_work); if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_active_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); @@ -881,6 +881,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + mt7921_roc_abort_sync(dev); mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov @ 2026-06-17 13:08 ` Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov 2 siblings, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-17 13:08 UTC (permalink / raw) To: stable; +Cc: sashal, Sean Wang, Quan Zhou, Felix Fietkau, Ajrat Makhmutov From: Sean Wang <sean.wang@mediatek.com> commit d5059e52fd8bc624ec4255c9fa01a266513d126b upstream. roc_abort_sync() can deadlock with roc_work(). roc_work() holds dev->mt76.mutex, while cancel_work_sync() waits for roc_work() to finish. If the caller already owns the same mutex, both sides block and no progress is possible. This deadlock can occur during station removal when mt76_sta_state() -> mt76_sta_remove() -> mt7921_mac_sta_remove() -> mt7921_roc_abort_sync() invokes cancel_work_sync() while roc_work() is still running and holding dev->mt76.mutex. This avoids the mutex deadlock and preserves exactly-once work ownership. Fixes: 352d966126e6 ("wifi: mt76: mt7921: fix a potential association failure upon resuming") Co-developed-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20260126180013.8167-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> [Ajrat: keep del_timer_sync() instead of timer_delete_sync() — the timer API rename is not present in 6.12.y. ] Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; tag the 6.12.y adaptation note as [Ajrat] and add backporter Signed-off-by. No code change. drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index f2fffca868b51..99561094640f1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -365,12 +365,15 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) { struct mt792x_phy *phy = &dev->phy; + if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) + return; + del_timer_sync(&phy->roc_timer); - cancel_work_sync(&phy->roc_work); - if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + cancel_work(&phy->roc_work); + + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov @ 2026-06-18 8:14 ` Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov ` (2 more replies) 2 siblings, 3 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-18 8:14 UTC (permalink / raw) To: stable; +Cc: sashal, nbd, linux-wireless This series backports three mt76/mt7921 fixes to 6.12.y. All three are in mainline; none carried Cc: stable, so they were not auto-selected for 6.12.y. Per your earlier reply, resending as a three-patch series: https://lore.kernel.org/all/20260610-stable-reply-0014@kernel.org/ d5059e52 is already in the v6.18.y and v7.0.y stable trees: https://github.com/gregkh/linux/commit/91e77840bf13de3add125060cf8b32ca24a52c8c https://github.com/gregkh/linux/commit/35180c772f5e11e2fa4d80d3dfd50906cb6d9646 The three must go together. 5ed54896 adds mt7921_roc_abort_sync() on the sta-remove path, which runs under dev->mt76.mutex (taken by mt76_sta_remove()); d5059e52 then turns cancel_work_sync() inside roc_abort_sync() into cancel_work() to avoid a self-deadlock with roc_work(). Applying 5ed54896 alone queues a reachable deadlock. 6.12.y note: d5059e52 keeps del_timer_sync() -- the timer_delete_sync() rename is not in 6.12.y. The other two cherry-pick cleanly. Tested on MT7921e: Acer Aspire 5 A517-52, ASUS VivoBook S14, Lenovo IdeaPad Slim 5 14AHP9. Link to v2: https://lore.kernel.org/all/20260617130826.1667503-1-rauty@altlinux.org/ v3: * subject prefix now carries target branch (6.12.y) * cover letter added with stable backport status of d5059e52 * no code changes ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 6.12.y v3 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov @ 2026-06-18 8:14 ` Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2 siblings, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-18 8:14 UTC (permalink / raw) To: stable Cc: sashal, nbd, linux-wireless, Leon Yen, Ming Yen Hsieh, David Ruth, Ajrat Makhmutov From: Leon Yen <leon.yen@mediatek.com> commit 2425dc7beaadc39c2636f97f8bdc22dc3cf88149 upstream. Some countries have strict RF restrictions where changing the regulatory domain dynamically based on the connected AP is not acceptable. This patch disables Beacon country IE hinting when a valid country code is set from usersland (e.g., by system using iw or CRDA). Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; add backporter Signed-off-by. No code change. v3: add cover letter with upstream/stable references; mark target 6.12.y. drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 4bd533c4ba9a1..276dfb9c26e0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -137,6 +137,13 @@ mt7921_regd_notifier(struct wiphy *wiphy, dev->mt76.region = request->dfs_region; dev->country_ie_env = request->country_ie_env; + if (request->initiator == NL80211_REGDOM_SET_BY_USER) { + if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0') + wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; + else + wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; + } + if (pm->suspended) return; -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6.12.y v3 2/3] wifi: mt76: mt7921: fix a potential scan no APs 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov @ 2026-06-18 8:14 ` Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2 siblings, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-18 8:14 UTC (permalink / raw) To: stable Cc: sashal, nbd, linux-wireless, Quan Zhou, Sean Wang, David Ruth, Ajrat Makhmutov From: Quan Zhou <quan.zhou@mediatek.com> commit 5ed54896b6bd444223092cab361b0785932119ab upstream. In multi-channel scenarios, the granted channel must be aborted before station remove. Otherwise, the firmware will be put into a wrong state, resulting in have chance to make subsequence scan no APs. With this patch, the granted channel will be always aborted before station remove. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Reviewed-by: Sean Wang <sean.wang@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Reviewed-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/1ac1ae779db86d4012199a24ea2ca74050ed4af6.1721300411.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; add backporter Signed-off-by. No code change. v3: add cover letter with upstream/stable references; mark target 6.12.y. drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index a93ae4e44f16a..f2fffca868b51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -368,9 +368,9 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) del_timer_sync(&phy->roc_timer); cancel_work_sync(&phy->roc_work); if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_active_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); @@ -881,6 +881,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + mt7921_roc_abort_sync(dev); mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6.12.y v3 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov @ 2026-06-18 8:14 ` Ajrat Makhmutov 2 siblings, 0 replies; 15+ messages in thread From: Ajrat Makhmutov @ 2026-06-18 8:14 UTC (permalink / raw) To: stable; +Cc: sashal, nbd, linux-wireless, Sean Wang, Quan Zhou, Ajrat Makhmutov From: Sean Wang <sean.wang@mediatek.com> commit d5059e52fd8bc624ec4255c9fa01a266513d126b upstream. roc_abort_sync() can deadlock with roc_work(). roc_work() holds dev->mt76.mutex, while cancel_work_sync() waits for roc_work() to finish. If the caller already owns the same mutex, both sides block and no progress is possible. This deadlock can occur during station removal when mt76_sta_state() -> mt76_sta_remove() -> mt7921_mac_sta_remove() -> mt7921_roc_abort_sync() invokes cancel_work_sync() while roc_work() is still running and holding dev->mt76.mutex. This avoids the mutex deadlock and preserves exactly-once work ownership. Fixes: 352d966126e6 ("wifi: mt76: mt7921: fix a potential association failure upon resuming") Co-developed-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20260126180013.8167-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> [Ajrat: keep del_timer_sync() instead of timer_delete_sync() -- the timer API rename is not present in 6.12.y. ] Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org> --- v2: drop redundant "cherry picked from" trailer; tag the 6.12.y adaptation note as [Ajrat] and add backporter Signed-off-by. No code change. v3: add cover letter with upstream/stable references; mark target 6.12.y. drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index f2fffca868b51..99561094640f1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -365,12 +365,15 @@ void mt7921_roc_abort_sync(struct mt792x_dev *dev) { struct mt792x_phy *phy = &dev->phy; + if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) + return; + del_timer_sync(&phy->roc_timer); - cancel_work_sync(&phy->roc_work); - if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) - ieee80211_iterate_interfaces(mt76_hw(dev), - IEEE80211_IFACE_ITER_RESUME_ALL, - mt7921_roc_iter, (void *)phy); + cancel_work(&phy->roc_work); + + ieee80211_iterate_interfaces(mt76_hw(dev), + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_roc_iter, (void *)phy); } EXPORT_SYMBOL_GPL(mt7921_roc_abort_sync); -- 2.50.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-06-19 4:07 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-10 8:09 [stable request] mt7921e: backport two mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-11 0:45 ` Sasha Levin 2026-06-11 10:38 ` Ajrat Makhmutov 2026-06-16 13:21 ` Ajrat Makhmutov 2026-06-19 4:06 ` Sasha Levin 2026-06-17 12:57 ` [PATCH 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-17 12:57 ` [PATCH 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-17 13:08 ` [PATCH v2 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 0/3] mt7921e: backport three mt76 fixes to 6.12.y Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 1/3] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 2/3] wifi: mt76: mt7921: fix a potential scan no APs Ajrat Makhmutov 2026-06-18 8:14 ` [PATCH 6.12.y v3 3/3] wifi: mt76: mt7921: fix potential deadlock in mt7921_roc_abort_sync Ajrat Makhmutov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).