Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f23cdfb3 authored by Miaoqing Pan's avatar Miaoqing Pan Committed by Kalle Valo
Browse files

ath9k: Use mutex_lock to avoid potential race in start/stop rng



Move ath9k_rng_stop/ath9k_rng_start pair into critical section,
use mutex_lock to void potential race accessing.

Signed-off-by: default avatarMiaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 473becac
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -731,12 +731,12 @@ static int ath9k_start(struct ieee80211_hw *hw)


	spin_unlock_bh(&sc->sc_pcu_lock);
	spin_unlock_bh(&sc->sc_pcu_lock);


	ath9k_rng_start(sc);

	mutex_unlock(&sc->mutex);
	mutex_unlock(&sc->mutex);


	ath9k_ps_restore(sc);
	ath9k_ps_restore(sc);


	ath9k_rng_start(sc);

	return 0;
	return 0;
}
}


@@ -826,10 +826,10 @@ static void ath9k_stop(struct ieee80211_hw *hw)


	ath9k_deinit_channel_context(sc);
	ath9k_deinit_channel_context(sc);


	ath9k_rng_stop(sc);

	mutex_lock(&sc->mutex);
	mutex_lock(&sc->mutex);


	ath9k_rng_stop(sc);

	ath_cancel_work(sc);
	ath_cancel_work(sc);


	if (test_bit(ATH_OP_INVALID, &common->op_flags)) {
	if (test_bit(ATH_OP_INVALID, &common->op_flags)) {