]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
eth: 8139too: fix calling napi_enable() in atomic context
authorJakub Kicinski <kuba@kernel.org>
Fri, 24 Jan 2025 03:18:38 +0000 (19:18 -0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 27 Jan 2025 22:30:49 +0000 (14:30 -0800)
napi_enable() may sleep now, take netdev_lock() before tp->lock and
tp->rx_lock.

Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/dcfd56bc-de32-4b11-9e19-d8bd1543745d@stanley.mountain
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Link: https://patch.msgid.link/20250124031841.1179756-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/realtek/8139too.c

index 9ce0e8a64ba83ee8d10b5f4f0fa84da84d87f363..a73dcaffa8c5dd55a73b07326e3e40bb49977793 100644 (file)
@@ -1684,6 +1684,7 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
        if (tmp8 & CmdTxEnb)
                RTL_W8 (ChipCmd, CmdRxEnb);
 
+       netdev_lock(dev);
        spin_lock_bh(&tp->rx_lock);
        /* Disable interrupts by clearing the interrupt mask. */
        RTL_W16 (IntrMask, 0x0000);
@@ -1694,11 +1695,12 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
        spin_unlock_irq(&tp->lock);
 
        /* ...and finally, reset everything */
-       napi_enable(&tp->napi);
+       napi_enable_locked(&tp->napi);
        rtl8139_hw_start(dev);
        netif_wake_queue(dev);
 
        spin_unlock_bh(&tp->rx_lock);
+       netdev_unlock(dev);
 }
 
 static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)