[PATCH] phy: phy-mtk-dp: Suppress sysfs bind/unbind
From: Hank Liou via B4 Relay
Date: Fri Nov 27 2026 - 01:13:09 EST
From: Hank Liou <hank.liou@xxxxxxxxxxxx>
mtk_dp_register_phy() registers the "mediatek-dp-phy" platform device
as a child of mtk_dp and caches the struct phy returned by
devm_phy_get() in mtk_dp->phy. The PHY driver still exposes the sysfs
unbind attribute, so root can unbind the child while mediatek-drm-dp
stays bound. devres then frees the struct phy, and the next
phy_configure(), phy_reset() or phy_init() call from mtk_dp uses freed
memory.
This was observed on a MT8188 Chromebook running a ChromeOS 6.1 kernel:
after unbinding the PHY device from sysfs, plugging in a DP monitor
panics in phy_reset() from the HPD IRQ thread.
The legacy PHY device is only created and destroyed by its parent, so
set suppress_bind_attrs to drop the bind/unbind attributes and let the
PHY go away only together with mtk_dp.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Signed-off-by: Hank Liou <hank.liou@xxxxxxxxxxxx>
---
Other PHY drivers disable sysfs bind/unbind for the same reason, e.g. commit 6aeec986f1bc ("phy: samsung: disable bind/unbind platform driver feature"): their consumers have no way to be told that the PHY went away.
---
drivers/phy/mediatek/phy-mtk-dp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/mediatek/phy-mtk-dp.c b/drivers/phy/mediatek/phy-mtk-dp.c
index 0048e1a8c6..924f08ed4d 100644
--- a/drivers/phy/mediatek/phy-mtk-dp.c
+++ b/drivers/phy/mediatek/phy-mtk-dp.c
@@ -828,6 +828,7 @@ static struct platform_driver mtk_dp_phy_driver = {
.driver = {
.name = "mediatek-dp-phy",
.of_match_table = mtk_dp_phy_of_match,
+ .suppress_bind_attrs = true,
},
};
module_platform_driver(mtk_dp_phy_driver);
---
base-commit: ebb7a8dc1e74c705daffe11c2faf38ec2628f838
change-id: 20261127-phy-mtk-dp-suppress-bind-5c85f734dfeb
Best regards,
--
Hank Liou <hank.liou@xxxxxxxxxxxx>