From: sashiko-bot@kernel.org
To: "Leon Romanovsky" <leon@kernel.org>
Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
linux-pci@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 10/19] net: phy: Use the compatibility driver attachment API
Date: Tue, 10 Nov 2026 07:35:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-206510@kernel.org> (raw)
In-Reply-To: <20261109-device-trust-core-v2-10-3b12d9a9f861@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: phy: loss of phydev->irq in phy_attach_direct() on
-EBUSY probe failure
--
commit 89d719155ade2a67c02be5cec992ec1828452066
Author: Leon Romanovsky <leon@kernel.org>
net: phy: Use the compatibility driver attachment API
This commit switches generic PHY driver attachment in phy_attach_direct()
to device_driver_attach_full() and updates phy_probe() and phy_remove() to
manage phydev->is_genphy_driven.
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 5d4508bcfbe99..5f0ca981644ec 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1912,7 +1912,9 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> struct device *d = &phydev->mdio.dev;
> struct module *ndev_owner = NULL;
> struct module *drv_owner;
> + struct device_driver *drv;
> int irq = phydev->irq;
> + bool bind_genphy;
> int err;
>
> /* For Ethernet device drivers that register their own MDIO bus, we
> @@ -1939,16 +1941,16 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> /* Assume that if there is no driver, that it doesn't
> * exist, and we should use the genphy driver.
> */
> - if (!d->driver) {
> + drv = d->driver;
> + bind_genphy = !drv;
> + if (bind_genphy) {
> if (phydev->is_c45)
> - d->driver = &genphy_c45_driver.mdiodrv.driver;
> + drv = &genphy_c45_driver.mdiodrv.driver;
> else
> - d->driver = &genphy_driver.mdiodrv.driver;
> -
> - phydev->is_genphy_driven = 1;
> + drv = &genphy_driver.mdiodrv.driver;
> }
>
> - drv_owner = d->driver->owner;
> + drv_owner = drv->owner;
> if (!try_module_get(drv_owner)) {
> phydev_err(phydev, "failed to get the device driver module\n");
> err = -EIO;
> @@ -1956,11 +1958,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> }
> phydev->drv_owner = drv_owner;
>
> - if (phydev->is_genphy_driven) {
> - err = d->driver->probe(d);
> - if (err >= 0)
> - err = device_bind_driver(d);
> -
> + if (bind_genphy) {
> + err = device_driver_attach_full(drv, d);
> + if (err == -EBUSY)
> + irq = phydev->irq;
> if (err)
> goto error_module_put;
> }
[Severity: Medium]
Can this overwrite the saved irq with PHY_POLL when phy_probe() fails with
-EBUSY?
At the start of phy_probe(), !phy_drv_supports_irq(phydrv) sets phydev->irq
to PHY_POLL for the generic PHY drivers. If a later step in phy_probe()
returns -EBUSY (for example via phy_setup_ports() -> of_phy_ports() ->
phy_add_port(), or an MDIO bus read returning -EBUSY),
device_driver_attach_full() propagates -EBUSY after unbinding the driver.
Overwriting irq = phydev->irq on -EBUSY then causes the error_module_put
path to write PHY_POLL back to phydev->irq instead of restoring the
original interrupt number, leaving the PHY in polling mode on subsequent
attachments.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-device-trust-core-v2-0-3b12d9a9f861@nvidia.com?part=10
next prev parent reply other threads:[~2026-11-10 7:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 7:33 [PATCH v2 00/19] driver core: Authorize device trust before driver binding Leon Romanovsky
2026-11-09 7:33 ` [PATCH v2 01/19] Input: gameport - attach manual drivers through the driver core Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 02/19] wifi: mac80211_hwsim: lock device for manual driver binding Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 03/19] USB: Lock registered interfaces during " Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-10 14:19 ` Leon Romanovsky
2026-11-09 7:33 ` [PATCH v2 04/19] USB: Release interface claims refused during registration Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-10 14:23 ` Leon Romanovsky
2026-11-09 7:33 ` [PATCH v2 05/19] PNP: Attach card devices through the driver core Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 06/19] cdx: Propagate DMA configuration errors Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 07/19] driver core: Report deferred probes through sysfs drivers_probe Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 08/19] driver core: Add a compatibility API for manual driver attachment Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 09/19] Input: serio - use the compatibility driver attachment API Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-10 14:29 ` Leon Romanovsky
2026-11-09 7:33 ` [PATCH v2 10/19] net: phy: Use " Leon Romanovsky
2026-11-09 13:45 ` Andrew Lunn
2026-11-10 7:39 ` Leon Romanovsky
2026-11-10 14:31 ` Andrew Lunn
2026-11-10 14:58 ` Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot [this message]
2026-11-09 7:33 ` [PATCH v2 11/19] driver core: Introduce a generic device trust level Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-10 15:12 ` Leon Romanovsky
2026-11-09 7:33 ` [PATCH v2 12/19] driver core: Expose device trust authorization interfaces Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 13/19] driver core: Accept device trust policy on the kernel command line Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 14/19] driver core: Accept device trust policy by driver name Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 15/19] driver core: Expose committed device trust level Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 16/19] driver core: Cover trust authorization and binding with KUnit Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 17/19] driver core: Document trust admission and initrd authorization Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 18/19] PCI: Replace untrusted state with device trust Leon Romanovsky
2026-11-09 13:53 ` Robin Murphy
2026-11-10 12:22 ` Leon Romanovsky
2026-11-10 14:25 ` Jason Gunthorpe
2026-11-10 14:34 ` Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
2026-11-09 7:33 ` [PATCH v2 19/19] USB: Authorize devices and interfaces through " Leon Romanovsky
2026-11-10 7:35 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-206510@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=leon@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox