🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25741

[PATCH net v3 1/4] net: netcp: do not disable interrupts in the VLAN callbacks

#25741
From: Manuel Janocha via B4 Relay
Date: Wed, 02 Dec 2026 10:29
87 lines
13592 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. 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: 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: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375724-linux-kernel-netdev=dewy.ru
References: <20261202-cpsw-ale-lock-v3-0-b40dc361d6b9@amperfied.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375724-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 v3 1/4] net: netcp: do not disable interrupts in the
 VLAN callbacks
Date: Wed, 02 Dec 2026 10:29:27 +0000
Organization: Usenet Network
Message-ID: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>
References: <20261202-cpsw-ale-lock-v3-0-b40dc361d6b9@amperfied.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1949939"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Gmjp5QwHHHk7n/3ReMoBe0MG484= sha256:y3uvLyyaQDCJXAFHnbdKC7F3WPmHzBaGWTn5TMYydcc=
	sha1:4ppL3ZhPvggc5oObDV6F0CxBzHE= sha256:uFo3Jq50+9whX3U51bwWPu2ez3Yj52X7joJ3eJnduJY=
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 1538A117603; Wed,  2 Dec 2026 13:30:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 vEBfKFdFVs1r;
	Wed,  2 Dec 2026 13:30:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375724-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 933261175FF; Wed,  2 Dec 2026 13:29:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 9D12C21600; Wed,  2 Dec 2026 10:29:47 +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=1796207384;
	b=4tEMsWDBrRhJokLLzjxRcqY0BXarR8Juaeu4twg1xTgjAPHLDp8TJUGHmXO7Pzn4n80W
	 cDknA7SBH8P+ADeOkOS7wDeB9vNiUCRVHkxm5673DZ8Y5xYBCIDgY7ulA0QzlzrwFfEp7
	 KhNf6kiDx06QBJyCC6w0ewM0J4OSMpSANBMXsiyKuNoTkhE7KC2UKrKZcrVJOZaGlfVTM
	 1EnvdE8S594d7kf4x3Xhz4T3jtPtbusNGiABZdB9WFbecuqFp77TiLkmXLhNhRKB/tKOF
	 Kz8y5jmLJ/eEabcy76YkXG49trZ3aI9oE8Vmw76Ym9h9+AQTJ/sWPs10XrjhjhhuSfw==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796207384;
	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=JriDCzM1gLcfN1dIvf9g30QAYS8l5gLxhkGQl9Bwf1k=;
	b=DZlo0LlBjFPBErIEYeASJdU1nhoNfZZZ/VomdFdRDxOti8BSUf4WlRgTBOcIyJcw4tYz
	 XOoFvUWlcbnFp+k5zSOAx94h7XIc+6WJSu1QsYS3WW/hyIDJzbJjNzE4x4AiTBzfii/Zz
	 0gWACw3feA9xJ8hpOXER4b2ksst2I8eUQ6aYPMHyPb7N7DiHvWdU5Y6S6CF2hi+O9KfXC
	 rXIu9qEOoTbe4VYy8S7fewyZwLzsL0nCjdcHp9JVjLh+BTwljnpZjfkxrlAYFCK9auLPn
	 EWeZ7mOIrCTlf10FQxE/goOhF1q5GsZcQY4Bx07p319GBrHJckElY1W8TUFc9wLy9Mg==
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=cipFFufk;
	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 90439606A688;
	Wed,  2 Dec 2026 10:29:44 +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=cipFFufk
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=1796207383;
	b=5Xq7QO7mbtQlbxYuulaOd80U9mLDh+otrHbh+lRxI9c0V8mEDRwNm4pq3EahHQ7BY7x9
	 OAg+w7wVjiWT0caDBeuZYp5GQWomlHwiEJWo5cpSGKCH8TFglcKJiNQhyi80GG6uy8KKz
	 ejutDWb32D3OkayP5qrQEV+0Wd4QgH0ZuTImmDlK51b4gn+RyvaBA2hSNYkZ+md5fAjJu
	 +wXFwC9lEjwVU8jIDTnUAA9Z/LLUPB0pHsLySWh6Xz8sResrVhquLuCCk6GQlEbdJ2V+H
	 jS4rDnxJ/cT1iS/3Wiuv+aZWmqursAcTMuWb3fK3cXcRrArW6XAgLtiCBoqpksj4yIQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796207383;
	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=JriDCzM1gLcfN1dIvf9g30QAYS8l5gLxhkGQl9Bwf1k=;
	b=gYpZVPUsnDuWmie6ySeo4QQ6OeYpLPdX+vcsgpTx5+DfXdvgRamMRFsjlGKI9l31XWaG
	 jaQNYtIrQtowhw++syyM4h/mYIh5plTyUGc1J7pUrpzwI1r+oUw2op0UTSpJJq6T3yhRb
	 oatSieYBM7UEQQ5MpzahFjPP4/+lRN/HQ26Ai6EljWud+fxWrBBoQwih7p5dxgKUjjgig
	 shZEz0859OMCV9tz06lYT9dXyqx9TE4tkwN2qGjcklZFkqNupmnALbFxHsHrmF6V9heE/
	 50Dh8ph8d4M3gkWCOXNrnq5v9ezZEByRanmte+iwnApzGG3HXadg75e6mj9Q+lZM+1Q==
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=cipFFufk;
	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 ADA48606A322;
	Wed,  2 Dec 2026 10:29:43 +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=1796207383;
	b=MHcTUMVrc17EKkgu0Tg088na86xu4MriBEGtDPQgDoO/AqbRrbKICsZ07MK9vPHrE+5Q
	 lvCLl4HhTBtS07Ls2MpWPZo+66czShLeZ5zew0B1A5iwMydrTKLFV8z1g83iQvGznV2HW
	 3scwmmAxkJ2TO1KsznWhZ7kRs+YVQiMXXhdu/uzq/UlSg0DuV+AHLyjY1eyGyEJewu5jg
	 mtwvyr7ZtEuLcGyDUqyFwRsgZwlLeyjDk8zhKJvt+tCLWu47cmCwn24h1HkQpvrYfEC5p
	 eSJM7YjtBqccHP8Pd35RtbRxY3MT40ZkxcDEjICk19vh9im2iYwD0RTsatq3KrprtAw==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1796207383;
	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=JriDCzM1gLcfN1dIvf9g30QAYS8l5gLxhkGQl9Bwf1k=;
	b=wm5gb8FKFLutaw/GPAVASMfvSHFOjL+/SFp6r89HvnnJcQ+yOVNcZf4Ktd1yDH56hiyS
	 8UajjPoTM+TR2cIo3+gS/tTzcXpt4JvqTzPxCkINHZTtzSoe+SI4vf8Uwz5ggZJaD9GDi
	 HWjgc2f4YZFZwZDkC5Ipos/81PfhB1JB8C12BZtmKAJQivkFBfFvoYPp6hP9BbiAC0HuQ
	 9n6xAgfUtvCl8O2QX8uzu+KN4WeaPLqwi15gLYM7Hx2hqaF0mP8pxqTKo+dM8/UHqKp1B
	 miJAH9GrpEr5JBehoJ3WZ/+IcCZVnfyiCeVBbNmNAmQwyI6n5M5hqUTDdPu91xtxmWg==
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 29EA01F00893;
	Wed,  2 Dec 2026 10:29:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796207383;
	bh=JriDCzM1gLcfN1dIvf9g30QAYS8l5gLxhkGQl9Bwf1k=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To;
	b=cipFFufkNM0ztYN5op4r5BXaH5yRxEKmtyo5Vcc2FHE12pMV2eIfUmb0vi1uimKzc
	 oKzfDMuYAIR9Wrwi8JvoX/Gtt41pwlLb+ogjCnxR2IAXEUrwBt5TE0bILFmerZ/o1B
	 68V1k12MbVACfwELLJRpYdal0Gdn+u/v+P1kdUVA0GbtMPEezt1gnFlwsFKFPivZRY
	 T6A3egWAf+eyLgXE2FtFM5GAIEUsPpqZrslGgeAHIXbItkKA4F+cr66opRt4Cwqy8B
	 1xT+ate73Jm35lwGTlaWOW8CA0k7JDG2+A+DjD6qN/MTtBfK0mLp/uiSqutV+uJbyD
	 mqQWwaM6upXNA==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id AA9714F387;
	Wed,  2 Dec 2026 10:29:29 +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: <20261202-cpsw-ale-lock-v3-0-b40dc361d6b9@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=1796207368; l=3154;
 i=manuel.janocha@amperfied.com; s=20261127; h=from:subject:message-id;
 bh=We0InfJyE00JG2ueHwBeaRohRfAOwgcrOPZgr8yWPfU=;
 b=ERxxhNxhTYuAiWX6GkpZiRjZh41se6vp4cSTThVmvMbM4p+MfMA0Xv+JXTDehlDJOrbtiR12M
 6djE1yX0NbDBhIEq3gybYjQ+qElt6M16N84i+8MqEVrkpkgTWmWl7B0
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