Skip to content

Commit 110d420

Browse files
Toby Chengregkh
authored andcommitted
drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
[ Upstream commit b5af48e ] This fixes a use-after-free crash during rmmod. The DRM encoder is embedded inside the larger rockchip_hdmi, which is allocated with the component. The component memory gets freed before the main drm device is destroyed. Fix it by running encoder cleanup before tearing down its container. Signed-off-by: Toby Chen <tobyc@nvidia.com> [moved encoder cleanup above clk_disable, similar to bind-error-path] Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230317005126.496-1-tobyc@nvidia.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 79ca94b commit 110d420

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
640640
struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
641641

642642
dw_hdmi_unbind(hdmi->hdmi);
643+
drm_encoder_cleanup(&hdmi->encoder.encoder);
643644
clk_disable_unprepare(hdmi->ref_clk);
644645

645646
regulator_disable(hdmi->avdd_1v8);

0 commit comments

Comments
 (0)