Skip to content

Commit 461cf03

Browse files
Dan CarpenterKalle Valo
Dan Carpenter
authored and
Kalle Valo
committed
ath9k: Fix a locking bug in ath9k_add_interface()
We tried to revert commit d9c52fd ("ath9k: fix tx99 with monitor mode interface") but accidentally missed part of the locking change. The lock has to be held earlier so that we're holding it when we do "sc->tx99_vif = vif;" and also there in the current code there is a stray unlock before we have taken the lock. Fixes: 6df0580 ("ath9k: add back support for using active monitor interfaces for tx99") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 6510223 commit 461cf03

File tree

1 file changed

+1
-2
lines changed
  • drivers/net/wireless/ath/ath9k

1 file changed

+1
-2
lines changed

drivers/net/wireless/ath/ath9k/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
12511251
struct ath_vif *avp = (void *)vif->drv_priv;
12521252
struct ath_node *an = &avp->mcast_node;
12531253

1254+
mutex_lock(&sc->mutex);
12541255
if (IS_ENABLED(CONFIG_ATH9K_TX99)) {
12551256
if (sc->cur_chan->nvifs >= 1) {
12561257
mutex_unlock(&sc->mutex);
@@ -1259,8 +1260,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
12591260
sc->tx99_vif = vif;
12601261
}
12611262

1262-
mutex_lock(&sc->mutex);
1263-
12641263
ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
12651264
sc->cur_chan->nvifs++;
12661265

0 commit comments

Comments
 (0)