Skip to content

Commit d04bc23

Browse files
Quanzhoucengregkh
authored andcommitted
wifi: mt76: mt7921: fix ROC abort flow interruption in mt7921_roc_work
commit fdfa39f upstream. The mt7921_set_roc API may be executed concurrently with mt7921_roc_work, specifically between the following code paths: - The check and clear of MT76_STATE_ROC in mt7921_roc_work: if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) return; - The execution of ieee80211_iterate_active_interfaces. This race condition can interrupt the ROC abort flow, resulting in the ROC process failing to abort as expected. To address this defect, the modification of MT76_STATE_ROC is now protected by mt792x_mutex_acquire(phy->dev). This ensures that changes to the ROC state are properly synchronized, preventing race conditions and ensuring the ROC abort flow is not interrupted. Fixes: 034ae28 ("wifi: mt76: mt7921: introduce remain_on_channel support") Cc: stable@vger.kernel.org Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Reviewed-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/2568ece8b557e5dda79391414c834ef3233049b6.1769133724.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e451c32 commit d04bc23

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • drivers/net/wireless/mediatek/mt76/mt7921

drivers/net/wireless/mediatek/mt76/mt7921/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,11 @@ void mt7921_roc_work(struct work_struct *work)
361361
phy = (struct mt792x_phy *)container_of(work, struct mt792x_phy,
362362
roc_work);
363363

364-
if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
365-
return;
366-
367364
mt792x_mutex_acquire(phy->dev);
365+
if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state)) {
366+
mt792x_mutex_release(phy->dev);
367+
return;
368+
}
368369
ieee80211_iterate_active_interfaces(phy->mt76->hw,
369370
IEEE80211_IFACE_ITER_RESUME_ALL,
370371
mt7921_roc_iter, phy);

0 commit comments

Comments
 (0)