]> git.baikalelectronics.ru Git - kernel.git/commit
drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
authorToby Chen <tobyc@nvidia.com>
Fri, 17 Mar 2023 00:51:26 +0000 (17:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:35 +0000 (17:32 +0100)
commitf9aed8574740aa4aceb7153f60afd9b22b51b984
tree5f393ec1daea9f40ef31987396ba47144ecf0673
parenta7f93eb234014cf3ea05ad713eb3c8d141ed129b
drm/rockchip: dw_hdmi: cleanup drm encoder during unbind

[ Upstream commit b5af48eedcb53491c02ded55d5991e03d6da6dbf ]

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>
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c