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

Commit 599b13ad authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville
Browse files

ath5k: fix locking in tx_complete_poll_work



ath5k_reset must be called with sc->lock.  Since the tx queue
watchdog runs in a workqueue and accesses sc, it's appropriate
to just take the lock over the whole function.

Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 811ea256
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2294,6 +2294,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
	int i;
	int i;
	bool needreset = false;
	bool needreset = false;


	mutex_lock(&sc->lock);

	for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
	for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
		if (sc->txqs[i].setup) {
		if (sc->txqs[i].setup) {
			txq = &sc->txqs[i];
			txq = &sc->txqs[i];
@@ -2321,6 +2323,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
		ath5k_reset(sc, NULL, true);
		ath5k_reset(sc, NULL, true);
	}
	}


	mutex_unlock(&sc->lock);

	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
		msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT));
		msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT));
}
}