From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Tue, 1 Dec 2026 02:46:31 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D88F1F000C1; Tue, 1 Dec 2026 02:46:30 +0000 (UTC) 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== Subject: Re: [PATCH 1/4] net: ethernet: lantiq_etop: propagate mdiobus_register() errors From: netdev-bot+sashiko@kernel.org To: 18255117159@163.com 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 Date: Tue, 01 Dec 2026 02:46:29 +0000 Message-ID: <179609318984.3146.12786132029140913678@kernel.org> In-Reply-To: <20261130023745.820141-2-18255117159@163.com> References: <20261130023745.820141-2-18255117159@163.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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(<q_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