• Stanislaw Gruszka's avatar
    rt2x00: fix random stalls · 3780d038
    Stanislaw Gruszka authored
    Is possible that we stop queue and then do not wake up it again,
    especially when packets are transmitted fast. That can be easily
    reproduced with modified tx queue entry_num to some small value e.g. 16.
    
    If mac80211 already hold local->queue_stop_reason_lock, then we can wait
    on that lock in both rt2x00queue_pause_queue() and
    rt2x00queue_unpause_queue(). After drooping ->queue_stop_reason_lock
    is possible that __ieee80211_wake_queue() will be performed before
    __ieee80211_stop_queue(), hence we stop queue and newer wake up it
    again.
    
    Another race condition is possible when between rt2x00queue_threshold()
    check and rt2x00queue_pause_queue() we will process all pending tx
    buffers on different cpu. This might happen if for example interrupt
    will be triggered on cpu performing rt2x00mac_tx().
    
    To prevent race conditions serialize pause/unpause by queue->tx_lock.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
    Acked-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    3780d038
rt2x00dev.c 33.1 KB