staging: rtl8192e: Resolve circular locking with rx_pkt_pending_timer
authorPhilipp Hortmann <philipp.g.hortmann@gmail.com>
Sun, 24 Sep 2023 19:51:10 +0000 (21:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Sep 2023 09:14:32 +0000 (11:14 +0200)
Resolve circular locking from reorder_spinlock with rx_pkt_pending_timer.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/08ff2088b0264bef60142ca35f7198dd8afa963c.1695582999.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtllib_rx.c

index 456dd05e291d3d51185473d63a6f2770ede27b41..a7b6f837024d1b5ec555cab8987b87dadfe5a217 100644 (file)
@@ -693,8 +693,10 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
         * Rx buffering.
         */
        if (index > 0) {
+               spin_unlock_irqrestore(&ieee->reorder_spinlock, flags);
                if (timer_pending(&ts->rx_pkt_pending_timer))
                        del_timer_sync(&ts->rx_pkt_pending_timer);
+               spin_lock_irqsave(&ieee->reorder_spinlock, flags);
                ts->rx_timeout_indicate_seq = 0xffff;
 
                if (index > REORDER_WIN_SIZE) {
@@ -712,8 +714,10 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
        if (bPktInBuf && ts->rx_timeout_indicate_seq == 0xffff) {
                netdev_dbg(ieee->dev, "%s(): SET rx timeout timer\n", __func__);
                ts->rx_timeout_indicate_seq = ts->rx_indicate_seq;
+               spin_unlock_irqrestore(&ieee->reorder_spinlock, flags);
                mod_timer(&ts->rx_pkt_pending_timer, jiffies +
                          msecs_to_jiffies(ht_info->rx_reorder_pending_time));
+               spin_lock_irqsave(&ieee->reorder_spinlock, flags);
        }
        spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
 }