Article View: linux.kernel.netdev
Article #26352[PATCH net v4 1/4] net: netcp: do not disable interrupts in the VLAN callbacks
From: Manuel Janocha via B4 Relay
Date: Thu, 03 Dec 2026 12:14
Date: Thu, 03 Dec 2026 12:14
94 lines
14082 bytes
14082 bytes
From: Manuel Janocha <manuel.janocha@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.
The next patch, "net: ethernet: ti: cpsw_ale: serialize ALE table
accesses", makes cpsw_ale_add_vlan() and cpsw_ale_del_vlan() take a
lock with spin_lock_bh(). With netcp->lock still taken by
spin_lock_irqsave(), spin_unlock_bh() would then run with hard
interrupts disabled, which trips lockdep_assert_irqs_enabled() in
__local_bh_enable_ip() and can run pending softirqs with interrupts
off. That patch needs this one to be correct, so this one carries the
same Fixes tag and both are backported together.
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).
Fixes: 1767bb2d47b7 ("ipv6: mcast: Don't hold RTNL for IPV6_ADD_MEMBERSHIP and MCAST_JOIN_GROUP.")
Cc: stable@vger.kernel.org
Signed-off-by: Manuel Janocha <manuel.janocha@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
Technical Details
Message-ID:
<20261203-cpsw-ale-lock-v4-1-4ecfbc4bb042@amperfied.com>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376581-linux-kernel-netdev=dewy.ruReferences:
<20261203-cpsw-ale-lock-v4-0-4ecfbc4bb042@amperfied.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376581-linux-kernel-netdev=dewy.ru From: devnull+manuel.janocha.amperfied.com@kernel.org (Manuel Janocha via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH net v4 1/4] net: netcp: do not disable interrupts in the VLAN callbacks Date: Thu, 03 Dec 2026 12:14:15 +0000 Organization: Usenet Network Message-ID: <20261203-cpsw-ale-lock-v4-1-4ecfbc4bb042@amperfied.com> References: <20261203-cpsw-ale-lock-v4-0-4ecfbc4bb042@amperfied.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2483892"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:SzKgDVpmCcQEJhzNiLIjzs3XBAA= sha256:iFZS0eL830C4RI1HqGxrUbhuvE9xFeFmv514o5yIuYI= sha1:+KJTvkx+D/crnVfI1T0XivxvOCQ= sha256:aGW7lBTptR5iiEpDT/zOz2A4I9H52b81muZ9f5N1cZw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A31F4117927; Thu, 3 Dec 2026 15:15:22 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uD-cxms8QItU; Thu, 3 Dec 2026 15:15:20 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376581-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 722E21178E4; Thu, 3 Dec 2026 15:15:12 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id E02736058AB; Thu, 3 Dec 2026 12:15:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796300076; b=cBgLZOcYeaVMmV4d4xQ02757Z3TdG8dFOvWIft0bfN/+5FV8jlEtcKaZqlf715rJ9g12 Bp7WSm0ogHXzJele4scmjBZZP99eYTY4NDDqrkLiRRwivrriCUaCe8CfpEJndfH/Gbgkb 963RJQ6drMr95bqdGPWx4H2Q7JSO6zPy0rE8bpqj2TzMgcnB7kOHgp7aZEqPia+4jEpVk Jd1dfr7bXWdrHDPWsLIPHE0GXovafPU24+uCWgAlxwM0It6GVvkHf9BKTUKEUPrrgSYko Qrs8/xob4ARoLOQbj/5JCPyfq2NNjGbZxRhb/naLyyd32Y6EPxObm+BCX9HTZ5sRZ8g== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300076; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=gfVEpIp4VJ4g+RnrKs2Q5TjrNwOfRx1wa5PtOY55YP8=; b=HSUFsGXGDIIYxgxgtB/WcGYNoH5T1QBEL+v9VDFOpvgkhTnpx6cdYt9kVbdzoxssBTjk 6U+nz4A1RGlG6YxAkkqzMEBEUROLNn0C0xozrmT2GHBw63Sml7loaog7MusgBn87EgGf1 cIk9Vnzplg1IlZKfGPpSlcoKKAbC/cgzwMvN/bum7OPIux9aH43OI7JP8a6ZxL32D32/p 32vaUOIYksq6S7SWCSG5H2IhzkhY4jI+BQlhnWDTWoFz4zuXHYCEKR75vTJPUaJPpbQr1 uaDjfQF9b90bOBoZkyW/tPNU+/8cDBd4YsT+0DWThynkooQw22+ATjYQ39z1/J4wdDw== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XFe6JbD1; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E725E606AC1A; Thu, 3 Dec 2026 12:14:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XFe6JbD1 X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796300060; b=gxtXcZeIeezBuy6Z/MwozCYoYDm3sqEUxACE6fo0Zb0EJiJ+Ftup+5/QAs446dvEYyN2 5d9kVVj/UsGyATGg2xESa1+Eu0DyhLwrZa1yYpuPURfheGHYgMLbXmwrktbWmvzwoPW8t UW719R3wfQC16ReN3l+VMQ4XncsanEroJ2aWpfwKH3pJo5hbla3BaIoOMdR20NhZif/M3 0V2Vx5sQU7C+y0OjOA1NdLIBeRfyQD8CrCFf9G9gVGsRpD9Gsvuo2ovChGviwBIr+Yfto mgOg/ebqxlxXmYSitgbxg2TOSblygo3YrVv13O1In4EZv4xF7lHVDEXtbJxIm+9L4NA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300060; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=gfVEpIp4VJ4g+RnrKs2Q5TjrNwOfRx1wa5PtOY55YP8=; b=q7VP0MSD8qzP3aAJsLvQ7c6iwma4MZ/11izAWgN5XtQiCzmxCpgEiBLKnZvqK0RFQNcO Xshqm0UMbDHCfZZaTTXl3LEDMitX0O+amf9n5uRW0p9vRfauZ2HgDiVMG+1xzS4rr2/h0 omMH9c4rVRy9RQi6E++u+e+gXW93XSq+gqySSvoYfoiIOYoEBB/cMdn50nYChzkkxHUUs rb8+7Nm11Gq7cKy7C+Aox4IjzB7cDLwG/ZurJrlAjQFNoGY6La+9i+7JzTNQl99bbn1Ya S2czzWCCX7j2KE71M2OkJrYpoawbBrxwutAYfJszsqkOHe42GZEyhoTdEMRCu0dezsA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XFe6JbD1; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DB15606BCF2; Thu, 3 Dec 2026 12:14:19 +0000 (UTC) X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796300059; b=mU1kEODf+nxo1L3XLuKCQMMH7PLyr3hPL1L2IkTufLMtZB05ZXXxwAjcMRumh/tEDRI2 LTonRptVpTu+sxX+G0OeG7TyK1i4UiIOFEvLggsdWtCQYTnjvRLyJits1lDiSV9vrXIPS 7+gSpulCjz3iAYZI0paDTRPDdsKvurMY7qxoCZlqWwuEF0vQKd2dtuzzCOEqlAP/g+BN6 FthcTQlV7784PRJXweMnHray638+EimyzxXkFRpKx9MA8KKLXnj+72v5SyzySHlED8H0n t/1gaJyDBR4b5T93tgYEexfZyBecrQhxbo0nbcB5JSGD/3rjdOfbuTuowPVo1smmw2w== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796300059; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=gfVEpIp4VJ4g+RnrKs2Q5TjrNwOfRx1wa5PtOY55YP8=; b=RarDmKwI8wIT3QFQQ9w2KghF9uTDlT+KGoUW2EVNpQlvP671CxZ+3LrHFyPqDCU4UjxC pL036ZVESwasmdGBFeEPK8W+kRL8JgtWarim1khV5OMbA+CPsqaxgtAx4+XyG97T0tpRo fV3iWLohzU1nDHxLfICdGhXvWwPVDNCb/yWt0ysoQ7vXZbj0avTibLKIKPXgMcoL1j2ok eVmHCgt8OMLagfI67zIW8AkY2qmotf7TO6OXreIRCxCajNKoJUKy9zkCeiJU6Ib1Yj8Xg FCAFJQ9qQVxR3luDZHvApb9e9mYIugT5jQMArOeeHMoLfW58rDoBXaRkyVI0FUV64Qw== X-ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id DF3ED1F00A1F; Thu, 3 Dec 2026 12:14:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796300059; bh=gfVEpIp4VJ4g+RnrKs2Q5TjrNwOfRx1wa5PtOY55YP8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=XFe6JbD1aMLOc4NRK1cKa4Ee63L51XlYXFFvXUGBtLGD4GAP9ruR2AAUcWtBkZJ/f AYHKa9ThP5e1aUJIHmmeQAlV5gEoZEcO+bQudQQd9QLk7tpDmg/vIjyUakvhMH9kMY RR04HoPLzmER7NOAIF1+e3ewEfY8ykt7AQdVWy/SsilMaejrozcr5DNxNseAq40faC OvMVYApfpnE4IyXH9/g98rHMeeFFLV6jfdbDBxSUs3L/M5wi2oY3y5dLlYvPQ8uno4 cInhvpLJmbxxEFxyAcUXylXCiHWjRNBVzvRYsSQwQITkkOZc8qIfVJ0InkW4tNHEvX 3rBG91fm7FHWg== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 6CC814F970; Thu, 3 Dec 2026 12:14:18 +0000 (UTC) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261203-cpsw-ale-lock-v4-0-4ecfbc4bb042@amperfied.com> X-Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, Kuniyuki Iwashima <kuniyu@google.com>, Manuel Janocha <manuel.janocha@amperfied.com>, stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796300057; l=3599; i=manuel.janocha@amperfied.com; s=20261127; h=from:subject:message-id; bh=nhj7OC44yOo7VuLuw0zBb+Uym7VEq7tOt9LJ+PwE4RU=; b=y5zX0iwkjS5ZzHIWyDKxuKtziNxqV9pS7jliRep1ANbmcfp1MvSmHD2SIaJeogeSCzKymKt8k +LaV6b8fCGgAmACxc7bvzQz91NL3BfAfP8TlNsqFFgVeZufwAMcB8YF X-Developer-Key: i=manuel.janocha@amperfied.com; a=ed25519; pk=DEqXiAa78UfHuuvMWJsylc0F41gl8N+i7WtqrDb4xCQ= X-Endpoint-Received: by B4 Relay for manuel.janocha@amperfied.com/20261127 with auth_id=1666 X-Original-From: Manuel Janocha <manuel.janocha@amperfied.com> X-Reply-To: manuel.janocha@amperfied.com