Skip to content

Commit

Permalink
mt76: mac: run mt76x02_mac_work routine atomically
Browse files Browse the repository at this point in the history
Grab mt76_dev mutex in mt76x02_mac_work handler since it runs
concurrently with mt76x{0,2}_set_channel routines

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
  • Loading branch information
LorenzoBianconi authored and nbd168 committed Dec 28, 2018
1 parent 1d2819e commit 9c9fae3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mt76x02_mac.c
Expand Up @@ -779,6 +779,8 @@ void mt76x02_mac_work(struct work_struct *work)
mac_work.work);
int i, idx;

mutex_lock(&dev->mt76.mutex);

mt76x02_update_channel(&dev->mt76);
for (i = 0, idx = 0; i < 16; i++) {
u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i));
Expand All @@ -791,6 +793,8 @@ void mt76x02_mac_work(struct work_struct *work)
if (!dev->beacon_mask)
mt76x02_check_mac_err(dev);

mutex_unlock(&dev->mt76.mutex);

mt76_tx_status_check(&dev->mt76, NULL, false);

ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
Expand Down

0 comments on commit 9c9fae3

Please sign in to comment.