From: Manuel Janocha <manu…@amperfied.com> netcp_rx_add_vid() and netcp_rx_kill_vid() take netcp->lock with spin_lock_irqsave(). The lock only protects the module list walk and is otherwise taken in netcp_set_rx_mode() with spin_lock() under netif_addr_lock_bh(), and with spin_lock_irqsave() in the hook registration functions, which run in process context. It is never taken from hard interrupt context. Both callbacks are ndo_vlan_rx_add_vid and ndo_vlan_rx_kill_vid, which the VLAN core calls in process context. The callbacks end up in gbe_add_vid() and gbe_del_vid(), which call cpsw_ale_add_vlan() and cpsw_ale_del_vlan(). These scan the whole ALE table with MMIO accesses and run with interrupts disabled for that time. Use spin_lock_bh() instead. This keeps the exclusion against netcp_set_rx_mode() and does not disable hard interrupts. It is also a prerequisite for the next patch, which takes a lock in the ALE library with spin_lock_bh(), so that no caller holds off interrupts while it scans the table. Testing: compile-tested only (arm, multi_v7_defconfig with the netcp drivers enabled, W=1). No hardware with netcp was available. Tooling: this patch and its changelog were prepared with an AI coding assistant (Claude). Cc: stab…@vger.kernel.org Signed-off-by: Manuel Janocha <manu…@amperfied.com> --- drivers/net/ethernet/ti/netcp_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index f5e093dc983b..09fa4c732155 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -1881,12 +1881,11 @@ static int netcp_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) struct netcp_intf *netcp = netdev_priv(ndev); struct netcp_intf_modpriv *intf_modpriv; struct netcp_module *module; - unsigned long flags; int err = 0; dev_dbg(netcp->ndev_dev, "adding rx vlan id: %d\n", vid); - spin_lock_irqsave(&netcp->lock, flags); + spin_lock_bh(&netcp->lock); for_each_module(netcp, intf_modpriv) { module = intf_modpriv->netcp_module; if ((module->add_vid) && (vid != 0)) { @@ -1898,7 +1897,7 @@ static int netcp_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) } } } - spin_unlock_irqrestore(&netcp->lock, flags); + spin_unlock_bh(&netcp->lock); return err; } @@ -1908,12 +1907,11 @@ static int netcp_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) struct netcp_intf *netcp = netdev_priv(ndev); struct netcp_intf_modpriv *intf_modpriv; struct netcp_module *module; - unsigned long flags; int err = 0; dev_dbg(netcp->ndev_dev, "removing rx vlan id: %d\n", vid); - spin_lock_irqsave(&netcp->lock, flags); + spin_lock_bh(&netcp->lock); for_each_module(netcp, intf_modpriv) { module = intf_modpriv->netcp_module; if (module->del_vid) { @@ -1925,7 +1923,7 @@ static int netcp_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) } } } - spin_unlock_irqrestore(&netcp->lock, flags); + spin_unlock_bh(&netcp->lock); return err; }
-- 2.34.1