* [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
@ 2024-10-23 17:29 Cristian Ciocaltea
2024-11-09 22:13 ` Heiko Stübner
2024-12-08 16:59 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Cristian Ciocaltea @ 2024-10-23 17:29 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Heiko Stuebner, Algea Cao
Cc: kernel, linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Dmitry Osipenko
In some cases, rk_hdptx_phy_runtime_resume() may be invoked before
platform_set_drvdata() is executed in ->probe(), leading to a NULL
pointer dereference when using the return of dev_get_drvdata().
Ensure platform_set_drvdata() is called before devm_pm_runtime_enable().
Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Fixes: 553be2830c5f ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
index ceab9c71d3b53ae0b746a10c081fcfaa7d5c5ae7..0965b9d4f9cf1926ba2aaa54c3d1b105ecd1a5a2 100644
--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
+++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
@@ -1101,6 +1101,8 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(hdptx->grf),
"Could not get GRF syscon\n");
+ platform_set_drvdata(pdev, hdptx);
+
ret = devm_pm_runtime_enable(dev);
if (ret)
return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
@@ -1110,7 +1112,6 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(hdptx->phy),
"Failed to create HDMI PHY\n");
- platform_set_drvdata(pdev, hdptx);
phy_set_drvdata(hdptx->phy, hdptx);
phy_set_bus_width(hdptx->phy, 8);
---
base-commit: ceab669fdf7b7510b4e4997b33d6f66e433a96db
change-id: 20241023-phy-sam-hdptx-rpm-fix-b26094303718
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
2024-10-23 17:29 [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Cristian Ciocaltea
@ 2024-11-09 22:13 ` Heiko Stübner
2024-12-08 16:59 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Stübner @ 2024-11-09 22:13 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Algea Cao, Cristian Ciocaltea
Cc: kernel, linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Dmitry Osipenko
Am Mittwoch, 23. Oktober 2024, 19:29:54 CET schrieb Cristian Ciocaltea:
> In some cases, rk_hdptx_phy_runtime_resume() may be invoked before
> platform_set_drvdata() is executed in ->probe(), leading to a NULL
> pointer dereference when using the return of dev_get_drvdata().
>
> Ensure platform_set_drvdata() is called before devm_pm_runtime_enable().
>
> Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Fixes: 553be2830c5f ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver")
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
2024-10-23 17:29 [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Cristian Ciocaltea
2024-11-09 22:13 ` Heiko Stübner
@ 2024-12-08 16:59 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2024-12-08 16:59 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Heiko Stuebner, Algea Cao,
Cristian Ciocaltea
Cc: kernel, linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Dmitry Osipenko
On Wed, 23 Oct 2024 20:29:54 +0300, Cristian Ciocaltea wrote:
> In some cases, rk_hdptx_phy_runtime_resume() may be invoked before
> platform_set_drvdata() is executed in ->probe(), leading to a NULL
> pointer dereference when using the return of dev_get_drvdata().
>
> Ensure platform_set_drvdata() is called before devm_pm_runtime_enable().
>
>
> [...]
Applied, thanks!
[1/1] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
commit: 9d23e48654620fdccfcc74cc2cef04eaf7353d07
Best regards,
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-08 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 17:29 [PATCH] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Cristian Ciocaltea
2024-11-09 22:13 ` Heiko Stübner
2024-12-08 16:59 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).