Skip to contentSkip to conversation

drm/amd/display: Fix NULL pointer dereference at hibernate

PATCH In review Mario Limonciello 2 participants 2 messages Nov 29, 2023 – Nov 30, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Fix NULL pointer dereference at hibernate

During hibernate sequence the source context might not have a clk_mgr. So don't use it to look for DML2 support.

Fixes a2815ada8616 ("drm/amd/display: Introduce DML2")
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -2
index f3a9fdd2340d..e1c02527d04a 100644
@@ -4554,7 +4554,7 @@ void dc_resource_state_copy_construct(
 	struct dml2_context *dml2 = NULL;
 
 	// Need to preserve allocated dml2 context
-	if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+	if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
 		dml2 = dst_ctx->bw_ctx.dml2;
 #endif
 
@@ -4562,7 +4562,7 @@ void dc_resource_state_copy_construct(
 
 #ifdef CONFIG_DRM_AMD_DC_FP
 	// Preserve allocated dml2 context
-	if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+	if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
 		dst_ctx->bw_ctx.dml2 = dml2;
 #endif
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Mario Limonciello

During hibernate sequence the source context might not have a clk_mgr. So don't use it to look for DML2 support.

Fixes a2815ada8616 ("drm/amd/display: Introduce DML2")

Harry

Quoted 26 lines
---
  drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -2
index f3a9fdd2340d..e1c02527d04a 100644
@@ -4554,7 +4554,7 @@ void dc_resource_state_copy_construct(
  	struct dml2_context *dml2 = NULL;
 
  	// Need to preserve allocated dml2 context
-	if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+	if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
  		dml2 = dst_ctx->bw_ctx.dml2;
  #endif
 
@@ -4562,7 +4562,7 @@ void dc_resource_state_copy_construct(
 
  #ifdef CONFIG_DRM_AMD_DC_FP
  	// Preserve allocated dml2 context
-	if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+	if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
  		dst_ctx->bw_ctx.dml2 = dml2;
  #endif