Commit c8fed0d7 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Greg Kroah-Hartman

rt2x00: do not pause queue unconditionally on error path


[ Upstream commit 6dd80efd ]

Pausing queue without checking threshold is racy with txdone path.
Moreover we do not need pause queue on any error, but only if queue
is full - in case when we send RTS frame ( other cases of almost full
queue are already handled in rt2x00queue_write_tx_frame() ).

Patch fixes of theoretically possible problem of pausing empty
queue.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Tested-by: default avatarEnrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 29a63b03
......@@ -142,15 +142,25 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
if (!rt2x00dev->ops->hw->set_rts_threshold &&
(tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS |
IEEE80211_TX_RC_USE_CTS_PROTECT))) {
if (rt2x00queue_available(queue) <= 1)
goto exit_fail;
if (rt2x00queue_available(queue) <= 1) {
/*
* Recheck for full queue under lock to avoid race
* conditions with rt2x00lib_txdone().
*/
spin_lock(&queue->tx_lock);
if (rt2x00queue_threshold(queue))
rt2x00queue_pause_queue(queue);
spin_unlock(&queue->tx_lock);
goto exit_free_skb;
}
if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb))
goto exit_fail;
goto exit_free_skb;
}
if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false)))
goto exit_fail;
goto exit_free_skb;
/*
* Pausing queue has to be serialized with rt2x00lib_txdone(). Note
......@@ -164,10 +174,6 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
return;
exit_fail:
spin_lock(&queue->tx_lock);
rt2x00queue_pause_queue(queue);
spin_unlock(&queue->tx_lock);
exit_free_skb:
ieee80211_free_txskb(hw, skb);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment