All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
@ 2023-03-17  0:51 ` Toby Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Toby Chen @ 2023-03-17  0:51 UTC (permalink / raw)
  To: Sandy Huang, Heiko Stubner; +Cc: linux-arm-kernel, linux-kernel, Toby Chen

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>
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 2f4b8f64cbad..8aa88e6c9e5a 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -642,6 +642,8 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
 	dw_hdmi_unbind(hdmi->hdmi);
 	clk_disable_unprepare(hdmi->ref_clk);
 
+	drm_encoder_cleanup(&hdmi->encoder.encoder);
+
 	regulator_disable(hdmi->avdd_1v8);
 	regulator_disable(hdmi->avdd_0v9);
 }
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
@ 2023-03-17  0:51 ` Toby Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Toby Chen @ 2023-03-17  0:51 UTC (permalink / raw)
  To: Sandy Huang, Heiko Stubner; +Cc: linux-arm-kernel, linux-kernel, Toby Chen

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>
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 2f4b8f64cbad..8aa88e6c9e5a 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -642,6 +642,8 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
 	dw_hdmi_unbind(hdmi->hdmi);
 	clk_disable_unprepare(hdmi->ref_clk);
 
+	drm_encoder_cleanup(&hdmi->encoder.encoder);
+
 	regulator_disable(hdmi->avdd_1v8);
 	regulator_disable(hdmi->avdd_0v9);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
  2023-03-17  0:51 ` Toby Chen
@ 2023-03-22 23:24   ` Heiko Stuebner
  -1 siblings, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2023-03-22 23:24 UTC (permalink / raw)
  To: Sandy Huang, Toby Chen; +Cc: Heiko Stuebner, linux-arm-kernel, linux-kernel

On Thu, 16 Mar 2023 17:51:26 -0700, Toby Chen wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
      commit: b5af48eedcb53491c02ded55d5991e03d6da6dbf

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
@ 2023-03-22 23:24   ` Heiko Stuebner
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2023-03-22 23:24 UTC (permalink / raw)
  To: Sandy Huang, Toby Chen; +Cc: Heiko Stuebner, linux-arm-kernel, linux-kernel

On Thu, 16 Mar 2023 17:51:26 -0700, Toby Chen wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind
      commit: b5af48eedcb53491c02ded55d5991e03d6da6dbf

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-22 23:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-17  0:51 [PATCH] drm/rockchip: dw_hdmi: cleanup drm encoder during unbind Toby Chen
2023-03-17  0:51 ` Toby Chen
2023-03-22 23:24 ` Heiko Stuebner
2023-03-22 23:24   ` Heiko Stuebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.