[PATCH v6 5/7] phy: qcom: snps-femto-v2: Fix possible NULL-deref on early runtime suspend
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Jul 22 06:56:57 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The patch leaves a window on the devm_phy_create() error path where a concurrent sysfs write could trigger a NULL pointer dereference in the runtime PM suspend callback.
--
--- Patch [5]: [PATCH v6 5/7] phy: qcom: snps-femto-v2: Fix possible NULL-deref on early runtime suspend ---
commit a0879a68c7ebe908247653778b80f7d2758ec42f
Author: Loic Poulain <loic.poulain at oss.qualcomm.com>
phy: qcom: snps-femto-v2: Fix possible NULL-deref on early runtime suspend
This commit holds a runtime PM usage reference during probe to prevent early
runtime suspend callbacks from dereferencing uninitialized PHY data. It also
converts the runtime PM enable call to its devres-managed variant to ensure
proper cleanup on driver removal.
> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
[ ... ]
> @@ -611,6 +621,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
> if (IS_ERR(generic_phy)) {
> ret = PTR_ERR(generic_phy);
> dev_err(dev, "failed to create phy, %d\n", ret);
> + pm_runtime_put_noidle(dev);
> return ret;
> }
[Severity: High]
This is a pre-existing issue, but does dropping the usage reference here
leave the device vulnerable to a NULL pointer dereference?
If devm_phy_create() fails, the driver drops its runtime PM usage count
and returns. Because devm_pm_runtime_enable() is used, runtime PM is not
disabled synchronously, but is deferred to devres cleanup.
In this window, could a concurrent sysfs write to power/control (e.g.,
from udev rules) trigger an asynchronous suspend?
Since devres cleanup calls pm_runtime_disable() which waits for any
in-progress suspend to complete rather than canceling it, and
dev_set_drvdata() is bypassed on this error path, wouldn't the runtime
suspend callback retrieve and dereference a NULL pointer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-qcom-usb-phy-fix-null-v6-0-534f7e61b9a6@oss.qualcomm.com?part=5
More information about the linux-phy
mailing list