]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/rockchip: dw_dp: Fix null-ptr-deref in dw_dp_remove()
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Mon, 9 Mar 2026 22:44:31 +0000 (00:44 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Thu, 26 Mar 2026 19:30:38 +0000 (20:30 +0100)
Attempting to access driver data in the platform driver ->remove()
callback may lead to a null pointer dereference since there is no
guaranty that the component ->bind() callback invoking
platform_set_drvdata() was executed.

A common scenario is when Rockchip DRM driver didn't manage to run
component_bind_all() because of an (unrelated) error causing early
return from rockchip_drm_bind().

Drop the unnecessary call to platform_get_drvdata() and, instead,
reference the target device structure via platform_device.

Fixes: d68ba7bac955 ("drm/rockchip: Add RK3588 DPTX output support")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20260310-drm-rk-fixes-v2-3-645ecfb43f49@collabora.com
drivers/gpu/drm/rockchip/dw_dp-rockchip.c

index 532af476d250a514f7de26531146d923e801d54d..8945a245398ca446a752ca5ecb99e0448fc4d67f 100644 (file)
@@ -133,9 +133,7 @@ static int dw_dp_probe(struct platform_device *pdev)
 
 static void dw_dp_remove(struct platform_device *pdev)
 {
-       struct rockchip_dw_dp *dp = platform_get_drvdata(pdev);
-
-       component_del(dp->dev, &dw_dp_rockchip_component_ops);
+       component_del(&pdev->dev, &dw_dp_rockchip_component_ops);
 }
 
 static const struct dw_dp_plat_data rk3588_dp_plat_data = {