Skip to content

Conversation

@zbowling
Copy link

@zbowling zbowling commented Jan 1, 2026

The MT7921 driver has the same mutex protection bugs as MT7925 - they were inherited when MT7925 was forked from MT7921. Several code paths iterate over active interfaces and call MCU functions without proper mutex protection.

Changes

Add mutex protection in the following locations:

  1. mt7921_set_runtime_pm() in main.c:
    Called when runtime PM settings change. The callback
    mt7921_pm_interface_iter() calls MCU functions that require
    the device mutex to be held.

  2. mt7921_regd_set_6ghz_power_type() in main.c:
    Called during VIF add/remove for 6GHz power type determination.
    Uses ieee80211_iterate_active_interfaces() without mutex.

  3. mt7921_mac_reset_work() in mac.c:
    After firmware recovery, iterates interfaces to reconnect them.
    The mt7921_vif_connect_iter() callback calls MCU functions.

  4. PCI/SDIO suspend paths (pci.c, sdio.c):
    The mt7921_roc_abort_sync() call iterates interfaces without
    mutex protection.

Impact

These bugs can cause system hangs during:

  • Power management state transitions
  • WiFi reset/recovery
  • Suspend/resume cycles
  • 6GHz regulatory power type changes

Testing

The fix follows the same pattern used in my MT7925 mutex patches (PR #1029 #1030 #1031 #1032).

Related to:

Signed-off-by: Zac Bowling zac@zacbowling.com

The MT7921 driver has the same mutex protection bugs as MT7925 - they were
inherited when MT7925 was forked from MT7921. Several code paths iterate
over active interfaces and call MCU functions without proper mutex protection.

Add mutex protection in the following locations:

1. mt7921_set_runtime_pm() in main.c:
   Called when runtime PM settings change. The callback
   mt7921_pm_interface_iter() calls MCU functions that require
   the device mutex to be held.

2. mt7921_regd_set_6ghz_power_type() in main.c:
   Called during VIF add/remove for 6GHz power type determination.
   Uses ieee80211_iterate_active_interfaces() without mutex.

3. mt7921_mac_reset_work() in mac.c:
   After firmware recovery, iterates interfaces to reconnect them.
   The mt7921_vif_connect_iter() callback calls MCU functions.

4. PCI/SDIO suspend paths (pci.c, sdio.c):
   The mt7921_roc_abort_sync() call iterates interfaces without
   mutex protection.

These bugs can cause system hangs during:
- Power management state transitions
- WiFi reset/recovery
- Suspend/resume cycles
- 6GHz regulatory power type changes

The fix follows the same pattern used in the MT7925 patches.

Signed-off-by: Zac Bowling <zac@zacbowling.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant