🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24914

Re: [PATCH 1/4] net: ethernet: lantiq_etop: propagate mdiobus_register() errors

#24914
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 02:46
139 lines
12706 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 (1) · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch cannot achieve what its commit message says it does.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the error path
  the patch changes ends in a self-deadlock, and the code behind the…

--

net: ethernet: lantiq_etop: propagate mdiobus_register() errors

This commit changes ltq_etop_mdio_init() so that it returns the error from
mdiobus_register() as is, instead of turning every failure into -ENXIO.
The stated goal is to let the driver defer its probe when
mdiobus_register() returns -EPROBE_DEFER.

> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index 83ce3bfefa5c2..8c64687c3fd85 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
> @@ -400,10 +400,9 @@ ltq_etop_mdio_init(struct net_device *dev)
>  	priv->mii_bus->name = "ltq_mii";
>  	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
>  		 priv->pdev->name, priv->pdev->id);
> -	if (mdiobus_register(priv->mii_bus)) {
> -		err = -ENXIO;
> +	err = mdiobus_register(priv->mii_bus);
> +	if (err)
>  		goto err_out_free_mdiobus;
> -	}

[Severity: High]
Can this driver actually defer its probe? The commit message says this is
"so the driver can defer correctly when probed from async context". But
init_ltq_etop() binds the driver through platform_driver_probe():

init_ltq_etop()
    int ret = platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);

Also, ltq_etop_probe() is marked __init.

__platform_driver_probe() rejects PROBE_PREFER_ASYNCHRONOUS and forces
PROBE_FORCE_SYNCHRONOUS. It also sets:

    drv->prevent_deferred_probe = true;

platform_probe() then rewrites the error:

    if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
        dev_warn(_dev, "probe deferral not supported\n");
        ret = -ENXIO;
    }

So -EPROBE_DEFER from mdiobus_register() travels
ltq_etop_mdio_init() -> ltq_etop_init() -> register_netdev() ->
ltq_etop_probe() -> platform_probe() and still ends up as -ENXIO, as it
did before. The only difference is the new warning.

The device is never added to the deferred probe list. A retry could not
run anyway, because the __init probe is discarded after boot.

Is the only real change that other mdiobus_register() errors, such as
-ENOMEM or -EINVAL, now reach the caller unchanged? If deferral is the
goal, the driver would need platform_driver_register() with a non-__init
probe, plus a fixed ndo_init unwind (see below). If not, could the commit
message describe what actually changes?

The later patch in this series, "net: use dev_err_probe() for MDIO bus
registration errors", does not touch lantiq_etop.c, so this is still the
case at the end of the series.

The other failure path in the same function still overrides its error:

>  
>  	if (ltq_etop_mdio_probe(dev)) {
>  		err = -ENXIO;

ltq_etop_mdio_probe() can return -ENODEV or PTR_ERR(phy_connect()), and
both are still replaced with -ENXIO. Is that difference intended?

[Severity: High]
This is a pre-existing issue that this patch did not introduce. What
happens in ltq_etop_init() when the error passed up from here reaches it?

ltq_etop_init() is the ndo_init callback, so it runs under RTNL:

ltq_etop_probe()
  register_netdev()
    rtnl_net_lock_killable()
    register_netdevice()
      ltq_etop_init()

If ltq_etop_mdio_init() or ltq_etop_set_mac_address() fails, it unwinds
with:

drivers/net/ethernet/lantiq_etop.c:ltq_etop_init() {
    ...
err_netdev:
	unregister_netdev(dev);
	free_netdev(dev);
err_hw:
	ltq_etop_hw_exit(dev);
	return err;
}

Won't unregister_netdev() take rtnl_mutex again, via rtnl_net_dev_lock()
-> rtnl_net_lock() -> rtnl_lock(), while this task already holds it? That
would hang the probe thread while it holds RTNL.

Even if that deadlock did not happen, free_netdev() frees dev and its priv
area. ltq_etop_hw_exit(dev) would then walk priv->ch[] in freed memory.

ltq_etop_probe() would then free the netdev a second time on its err_free
path:

	err = register_netdev(dev);
	if (err)
		goto err_free;
	...
err_free:
	free_netdev(dev);

Should ndo_init only undo what it set up itself, and leave freeing the
netdev to the caller? This path can be reached if no PHY is found on the
bus, if phy_connect() fails, or if mdiobus_register() fails.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130023745.820141-1-18255117159%40163.com
Technical Details
Message-ID: <179609318984.3146.12786132029140913678@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374639-linux-kernel-netdev=dewy.ru
References: <20261130023745.820141-2-18255117159@163.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374639-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 1/4] net: ethernet: lantiq_etop: propagate
 mdiobus_register() errors
Date: Tue, 01 Dec 2026 02:46:29 +0000
Organization: Usenet Network
Message-ID: <179609318984.3146.12786132029140913678@kernel.org>
References: <20261130023745.820141-2-18255117159@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1593986"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Y4totT+DX+20YgMznvBRc8bmBtk= sha256:sNWqmXatmhHF7X6EUMhekj/lg5+llmK7FtEOR0EXcCU=
	sha1:5eXtUVkI/+XT0Ocbl9ff9YYmvlQ= sha256:kMRDjVzWi2wvv0Jl90rGYoHoI/d+GIYTcKG5XEoKpDY=
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 37CFC117207; Tue,  1 Dec 2026 05:46:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 1ZKeQ2otno7q;
	Tue,  1 Dec 2026 05:46:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374639-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 93434C9997; Tue,  1 Dec 2026 05:46:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E27A628BEF; Tue,  1 Dec 2026 02:46:32 +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=1796093192;
	b=Kvln/0ZgDwPCYXFlf6tXiSvhhgNQxLjXDUs/DALuqZz7vZg2Aq0g0473SKIhGQaCFnzW
	 1mRz08W7w0EliuaLCJuUjXlmo9BkREVlUcjNyL02cOwXBRqXKlcEMmojnhe+I2ZMRTY6R
	 sn8jVCKOUFm0gH91XbwwzxgFKJCNAASRzaKOJCDaYoaZDdypm0MHYODOuoqNXGgxa4LtZ
	 5BaLUirRbi9aNRBCMOkVyXvFD3xmW/maIVsLxQfyWmDkEnZHOTr9gY7tjj+4NA7L3RAJH
	 ykyDL3Sb1V6QLA2fQl+3mDPKdtjXOULyJD+OQ8/m8TeX2/IjxBRKcZts/8HHyp2Y3mA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796093192;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=C7enzCrtARTu6mdnI/5EHpUDfnG2Gx3gQ19WiwK24m8=;
	b=ljItR2fRu1z45sqPyR5/wEKr2KhjoCH4frDHlra08868wiVy+IwdnpJjf22KloIPxC4s
	 /Jbb+7s464lPPXL75j/+tnZfBqUIaYldGAXkN3Dw7tEVSm2Nb+pim37G2FPccG59n6sQY
	 +pVGVX7qLxlIHDUeHtow6lU9clkbajG5Wmh5rHSuPLrQJuXt7lFT+3heyRU9SZxLz3xx+
	 sy4UlFeqiq7ldSk3/Of6ukISfvqbptBKVNFebO+Qmdm0CtEXAwr6aq8FB7q/teitZjqWG
	 H128OXqth+t2ZnDJjiauzC8vBQKxeVeCcQdJgf42DIxcelN67CRnko/ibSRikypHjJA==
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=eKSi9WXO;
	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 3FA52606A32C;
	Tue,  1 Dec 2026 02:46:32 +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=eKSi9WXO
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=1796093191;
	b=47sX29rOIA/ROFkEtGJhQ3Xx7vudDdE/DSrPFyEcs0VHieBzhpv/Q9hjcjtOcm5dOppl
	 ER7sEIFZze8PbEBojOIxj/i9AvGotT0uFoTWQwgrefd3LG6WezHQiT60Aq+H1thSVnUty
	 S4rDHXXsp4WOlZfTxG1u5MIEZ8sldk+9lVUtM29x4ob/D0OvZ9ZBvD/mjThZT2f9XHh5X
	 HOBa4OvPpr7k5LknrZwl11KmY93jV2s4rL6o1cPkNxpQMOmxlSd7nrxTsmLD6geL2SygO
	 kPLi/2QJTC5ltMLWt6SNrYdMoYsNeYnU33hVZDIaJXUaNTkucx2Jkg2oCqwBoakudVg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796093191;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=C7enzCrtARTu6mdnI/5EHpUDfnG2Gx3gQ19WiwK24m8=;
	b=EPVuI2SCqJlNmRjfzI3oKAXMav9uuof1uOA+eQRY9Ttvmq0qy1hTqCDQcZKQTTNSSiJo
	 L+5ddrB3M4LUP6DwA58rZEM24pWfOtCcmHPTU5mBlX9ztkU6OKxwCALvW/PijxXa+hdS3
	 uRmQAF5x9iLYYgA/QHB7i05PHc6LidZH19XSwnenlVCLPVcfRiRN5lWN27+6tGQ59B7Vp
	 aiRAYlHHYqUvPs23kcJmwJW7u9M5xxuNrAUHgweg1/dcAFagPa6I6jB9FTWOPdv4QQxyk
	 AEevOOlAQQaf0b6Evcpw3O67BUTXUpT19rNP+0k+qStzAQbht3e6ulWZ4HiqgHOwBwg==
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=eKSi9WXO;
	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 5BAD1606A31A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 02:46:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D88F1F000C1;
	Tue,  1 Dec 2026 02:46:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796093190;
	bh=C7enzCrtARTu6mdnI/5EHpUDfnG2Gx3gQ19WiwK24m8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=eKSi9WXOckh279/6vY4GFzcK0NExs0+zWimc8kwQZFCtip4qeN4IMHwy4raivnhsT
	 Wa8yEe/P5kMDSGozw7tW8wjoJCkxcjxigLDiF1Nzu35mUhC0t24go5Ad3agJKUnbg2
	 SfxZy+0E7QQBWkN/rP7JQVf7AQzTVaEMjTh6IXSwv70e2vkmZAObXL61UPvJOTI8t9
	 4dQx4qEuwrV4ZdmBVA5y2OjDzCr2Tqj6BXLGS/ZZlc7yc6nfCAZZqjmEb4ZzEPV5oS
	 Jmhd06NTmud7lIsP7Qe2XOdFruDC6EJLGvANGhVnb3yOJJr2aZCr+tolVqzEUIQ7Zu
	 o2lzpn1xPYZQg==
X-Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org
X-In-Reply-To: <20261130023745.820141-2-18255117159@163.com>
X-sashiko-severity: High
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