Article View: linux.kernel.netdev
Article #10546[PATCH net-next v6 01/15] net: ethernet: cortina: Keep shared free queue parent-owned
From: Linus Walleij
Date: Tue, 03 Nov 2026 17:51
Date: Tue, 03 Nov 2026 17:51
78 lines
10855 bytes
10855 bytes
The software free queue is shared by both Ethernet ports, but teardown is
not ordered around that ownership. On parent unbind or module unload, the
parent remove callback runs before devres depopulates the child devices. It
therefore destroys the queue while both child netdevs are still registered
and can be doing DMA. Devres then removes each child, and both child remove
callbacks destroy the same queue again, resulting in up to three cleanup
attempts.
Removal before the first interface has been opened is broken as well. The
shared block initialization assigns a nonzero queue order, but allocation
is deferred until open. Cleanup consequently derives a nonzero page count
and dereferences the NULL queue ring.
Depopulate both port devices before cleaning up the queue, and perform that
cleanup only from the parent. Disable the free-queue interrupt after the
managed handlers have drained, since its threaded handler can re-enable it.
Guard cleanup for paths where no queue was allocated.
Port 1 owns the shared refill interrupt, so prevent the children from being
unbound independently. Unregister each netdev before detaching its PHY so
ndo_stop can still access netdev->phydev.
Reported-by: Myeonghun Pak <mhun512@gmail.com>
Closes: https://lore.kernel.org/netdev/20260917192835.58126-1-mhun512@gmail.com/
Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
drivers/net/ethernet/cortina/gemini.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index 2fe7fd0202d2..bf7652b04f1b 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -1004,6 +1004,9 @@ static void geth_cleanup_freeq(struct gemini_ethernet *geth)
unsigned int pages = len >> fpp_order;
unsigned int pn;
+ if (!geth->freeq_ring)
+ return;
+
writew(readw(geth->base + GLOBAL_SWFQ_RWPTR_REG),
geth->base + GLOBAL_SWFQ_RWPTR_REG + 2);
writel(0, geth->base + GLOBAL_SW_FREEQ_BASE_SIZE_REG);
@@ -2387,11 +2390,10 @@ static irqreturn_t gemini_port_irq(int irq, void *data)
static void gemini_port_remove(struct gemini_ethernet_port *port)
{
if (port->netdev) {
- phy_disconnect(port->netdev->phydev);
unregister_netdev(port->netdev);
+ phy_disconnect(port->netdev->phydev);
}
clk_disable_unprepare(port->pclk);
- geth_cleanup_freeq(port->geth);
}
static void gemini_ethernet_init(struct gemini_ethernet *geth)
@@ -2635,6 +2637,7 @@ static struct platform_driver gemini_ethernet_port_driver = {
.driver = {
.name = "gemini-ethernet-port",
.of_match_table = gemini_ethernet_port_of_match,
+ .suppress_bind_attrs = true,
},
.probe = gemini_ethernet_port_probe,
.remove = gemini_ethernet_port_remove,
@@ -2683,6 +2686,8 @@ static void gemini_ethernet_remove(struct platform_device *pdev)
{
struct gemini_ethernet *geth = platform_get_drvdata(pdev);
+ devm_of_platform_depopulate(&pdev->dev);
+ writel(0, geth->base + GLOBAL_INTERRUPT_ENABLE_4_REG);
geth_cleanup_freeq(geth);
geth->initialized = false;
}
--
2.56.0
Technical Details
Message-ID:
<20261103-gemini-ethernet-fixes-3-v6-1-c4b5ff8a65d8@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355882-linux-kernel-netdev=dewy.ruReferences:
<20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355882-linux-kernel-netdev=dewy.ru From: linusw@kernel.org (Linus Walleij) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v6 01/15] net: ethernet: cortina: Keep shared free queue parent-owned Date: Tue, 03 Nov 2026 18:51:12 +0100 Organization: Usenet Network Message-ID: <20261103-gemini-ethernet-fixes-3-v6-1-c4b5ff8a65d8@kernel.org> References: <20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3224024"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:gfifoNueWr0Dom1eTOeGfn6Qudk= sha256:kUk79goQ4qWaJaHz/lmXbxsTsfEEkH9V+/PJNz9NcP8= sha1:LnNbHwE6jLsxpwNQhVIJolAv98E= sha256:hSD68IZMffr9rB16zDO7DxPy+zJfVGkv272V5xhwmbs= 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 46983112956; Tue, 3 Nov 2026 20:51:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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 p1vRUsA9KPwO; Tue, 3 Nov 2026 20:51:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355882-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 CF972112971; Tue, 3 Nov 2026 20:51:36 +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 040A1603C17; Tue, 3 Nov 2026 17:51:23 +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=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793728282; b=WNuPapZVNHAdzVsa98O8mhI2+PGv4pNemrY7Y9BNVsPEFcmI2R0YCc44cs9KQ9MZ5E8u QN7DGCgRLWuIpOf3Xc0iTONrALFb8V1myFkl9N2SdBw0z+FHk0grErYbpymWIRhLaJEAn sEuKcq0jqh3vCpFh3/MDvncTaID/MWKuVG5utwPCaZvJvrbexaAkMtwl+6PWgFoWQigub pWLZgMSDZbmjFEX3cfYV7OJ9jW5+uDGgFEuesXZZG6NQuHqRd2Lc954zLW58/CO0ishRU 9T+PNj5GcWtL8SJlxMvwPzR8l/uC97AiYQI7semYgyDAAW0d3Et9g0R+x/BzkHkQkRw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793728282; h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=TvwXf07XGLhnzy7I90Bhvn7ODIy/fcQKB7+2anJaAEo=; b=ZxM47YIf5EC3uJmCmr6TFxbgoC4nFawTQjlMmoc7o03uGq0SsRz2L9clpjh8faJZ27Ck CsDX4uOK2qTrcxg/SQLgR7xaC254CXZQZ/J34bVNUegL5bUQ1jf8iYqRk1MzmCQGOQDmg z7wWMpJ8sTX++hfN7i40TmnmfcWibP6h/L2nnyyrOHkGJQQnrjDm7eEFvTo3nYsuPe18a oAQvI1PjcT/jaMzV1Jmk9F8MD0I2H+8rkXssVewhJ5+YBy3adeR5k1jGKaT8lKRuMItDq RSCSPZesZBaM1xbsc2jV/CBzgF0XBTzTRzYttiGEUZWo/9OA5WglmQA7OSJ/7OjvtrQ== 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=MjGHF5Zn; 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 55A95606A335; Tue, 3 Nov 2026 17:51:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MjGHF5Zn X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793728281; b=Uw7xvvzfeifI4K+S2RbDXiEuBT22RbShZcJPemu3QTPH65VjYvCMHpoQOSSJwZDGqjKl hZrz74NGlQJppbrrnclbNT2mXoi8fGejmie+ZYehUIJiye0OAgffjrq1lOEJZfw5RD5SA vpZaCgjbsUYertnJUlysUO6UyZCShrgpURwDoxzWtgl+Ju+U1fjDiyGJs6mQRV7B/ALaD ZeCe255B5+JBwKvA6jknb4Z4h2ycLcRA6X40R2l0F+U60J9iK4eqgXlqpLbaKiqfQb44f P/+R6LRF+MgYOcMcqH/ZZDXKjexF75WXavLHVLcnH2cnjI7Hcwfw000T+OTkAXypuAw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793728281; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=TvwXf07XGLhnzy7I90Bhvn7ODIy/fcQKB7+2anJaAEo=; b=0ncQ2EQkwCPJWj85JQ2tKLaWJLOAfdyXLnM8FmEGdLJCcTg6tILWKQOR4QcpLAnhDplF RsrQtj3hitYmULxxVxs9w7KuZTy9PFQ8spKgpaxKQFcesQX4Xq7EjYVh5sG1fR31AKFxA VXrB0vge75hmGMA10ZA5dS+KEyTdEABOVSghRNPGBqUO3qoqOdFPOQOukRXpR+V8+JzsA cWhS1zUJ7IWsJ/zTooRJ7PHDv5wqQRFds/YgWe9Ayof1TDx/TZSDkGOXiXe2WzelRVkib PfUK0VPCP+ruENOJOfNt42e59XG4zmQ1I+ZDNftiSS05w4h8bNfSJMgS1UATLXQzG3w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MjGHF5Zn; arc=none 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 32D7C606A324 for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 17:51:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C1651F00919; Tue, 3 Nov 2026 17:51:17 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793728280; bh=TvwXf07XGLhnzy7I90Bhvn7ODIy/fcQKB7+2anJaAEo=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=MjGHF5Zn+QMXC6o/+PCzmKlblXZ3ZTVvmVyw7azTP4WNoAt1U9bhW9gbbbOJ8Fpqw PcDA1945H3p75te0e2c6hVkXcqy6HcK+rMa3yXdIEOHntcEmrAuNURg0dIdW20mKV8 OCuxFBgTo/8k+VvvKpwd/uzXyywwuLZBWozcvJwt/hR6aX1zniIBgAtFarQHC+K5Ja CihoFzR89CvcWOAP8mUoJ0+aJYE6kwQISWjNCsjN9gzBhuWbZyjPHTqFGycpgAk8bJ DhkUGkQ3+/6uj88AKSizK195dTDSzLRoxBnrJTisUk2HWFjvLIBZsfDcnlQKv7w0Nu /RXbCTC2ySEdg== 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: <20261103-gemini-ethernet-fixes-3-v6-0-c4b5ff8a65d8@kernel.org> X-Cc: netdev@vger.kernel.org, Linus Walleij <linusw@kernel.org> X-Mailer: b4 0.16.0