Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

eth: 8139too: fix calling napi_enable() in atomic context

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>

+3 -1
+3 -1
drivers/net/ethernet/realtek/8139too.c
··· 1684 1684 if (tmp8 & CmdTxEnb) 1685 1685 RTL_W8 (ChipCmd, CmdRxEnb); 1686 1686 1687 + netdev_lock(dev); 1687 1688 spin_lock_bh(&tp->rx_lock); 1688 1689 /* Disable interrupts by clearing the interrupt mask. */ 1689 1690 RTL_W16 (IntrMask, 0x0000); ··· 1695 1694 spin_unlock_irq(&tp->lock); 1696 1695 1697 1696 /* ...and finally, reset everything */ 1698 - napi_enable(&tp->napi); 1697 + napi_enable_locked(&tp->napi); 1699 1698 rtl8139_hw_start(dev); 1700 1699 netif_wake_queue(dev); 1701 1700 1702 1701 spin_unlock_bh(&tp->rx_lock); 1702 + netdev_unlock(dev); 1703 1703 } 1704 1704 1705 1705 static void rtl8139_tx_timeout(struct net_device *dev, unsigned int txqueue)