Skip to contentSkip to conversation

drm/amd/display: fix null pointer deref error

PATCH In review Aurabindo Pillai 3 participants 4 messages Jun 7, 2022

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

PATCH 1/1 drm/amd/display: fix null pointer deref error

[Why]
0 was passed in place of a pointer which triggered null pointer dereference.

[How]
Pass in a pointer that contains nullified parameters instead of null pointer.

---
 .../gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -3
index 631a8a2f9fc3..e7944c881148 100644
@@ -2191,15 +2191,18 @@ static void dce110_setup_audio_dto(
 			build_audio_output(context, pipe_ctx, &audio_output);
 
 			if (dc->res_pool->dccg && dc->res_pool->dccg->funcs->set_audio_dtbclk_dto) {
-				/* disable audio DTBCLK DTO */
-				dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
-					dc->res_pool->dccg, 0);
+				struct dtbclk_dto_params dto_params = {0};
 
 				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
 						pipe_ctx->stream_res.audio,
 						pipe_ctx->stream->signal,
 						&audio_output.crtc_info,
 						&audio_output.pll_info);
+
+				/* disable audio DTBCLK DTO */
+				dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
+					dc->res_pool->dccg, &dto_params);
+
 			} else
 				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
 					pipe_ctx->stream_res.audio,
Signature · 1 line
2.36.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Aurabindo Pillai

[Why]
0 was passed in place of a pointer which triggered null pointer dereference.

[How]
Pass in a pointer that contains nullified parameters instead of null pointer.

---
  .../gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c  | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -3
index 631a8a2f9fc3..e7944c881148 100644
@@ -2191,15 +2191,18 @@ static void dce110_setup_audio_dto(
  			build_audio_output(context, pipe_ctx, &audio_output);
 
  			if (dc->res_pool->dccg && dc->res_pool->dccg->funcs->set_audio_dtbclk_dto) {
-				/* disable audio DTBCLK DTO */
-				dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
-					dc->res_pool->dccg, 0);
+				struct dtbclk_dto_params dto_params = {0};
 
  				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
  						pipe_ctx->stream_res.audio,
  						pipe_ctx->stream->signal,

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c static void dce110_setup_audio_dto( · line 2208

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +5 -0
  						&audio_output.crtc_info,
  						&audio_output.pll_info);
+
+				/* disable audio DTBCLK DTO */
+				dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
+					dc->res_pool->dccg, &dto_params);
+
  			} else
  				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
  					pipe_ctx->stream_res.audio,

Maybe it is a good idea to add the Fixes tag that points to the commit that introduced this regression. Anyway, I'm ok with this change.

#2 lore raw
Quoted 30 lines · Rodrigo Siqueira Jordao
Quoted 26 lines · Aurabindo Pillai

[Why]
0 was passed in place of a pointer which triggered null pointer dereference.

[How]
Pass in a pointer that contains nullified parameters instead of null pointer.

---
  .../gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c  | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -3
index 631a8a2f9fc3..e7944c881148 100644
@@ -2191,15 +2191,18 @@ static void dce110_setup_audio_dto(
                      build_audio_output(context, pipe_ctx, &audio_output);
 
                      if (dc->res_pool->dccg && dc->res_pool->dccg->funcs->set_audio_dtbclk_dto) {
-                             /* disable audio DTBCLK DTO */
-                             dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
-                                     dc->res_pool->dccg, 0);
+                             struct dtbclk_dto_params dto_params = {0};
 
Quoted 16 lines

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c static void dce110_setup_audio_dto( · line 2208

Quoted 13 lines
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +5 -0
                              pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
                                              pipe_ctx->stream_res.audio,
                                              pipe_ctx->stream->signal,
                                              &audio_output.crtc_info,
                                              &audio_output.pll_info);
+
+                             /* disable audio DTBCLK DTO */
+                             dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
+                                     dc->res_pool->dccg, &dto_params);
+
                      } else
                              pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
                                      pipe_ctx->stream_res.audio,

Maybe it is a good idea to add the Fixes tag that points to the commit that introduced this regression. Anyway, I'm ok with this change.

Or at least explain in what case you might hit it or an example backtrace.

Alex

Quoted 3 lines
#3 lore raw
Quoted 49 lines · Alex Deucher
Quoted 30 lines · Rodrigo Siqueira Jordao
Quoted 26 lines · Aurabindo Pillai

[Why]
0 was passed in place of a pointer which triggered null pointer dereference.

[How]
Pass in a pointer that contains nullified parameters instead of null pointer.

---
   .../gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c  | 9 ++++++---
   1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -3
index 631a8a2f9fc3..e7944c881148 100644
@@ -2191,15 +2191,18 @@ static void dce110_setup_audio_dto(
                       build_audio_output(context, pipe_ctx, &audio_output);
 
                       if (dc->res_pool->dccg && dc->res_pool->dccg->funcs->set_audio_dtbclk_dto) {
-                             /* disable audio DTBCLK DTO */
-                             dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
-                                     dc->res_pool->dccg, 0);
+                             struct dtbclk_dto_params dto_params = {0};
 
Quoted 16 lines

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c static void dce110_setup_audio_dto( · line 2208

Quoted 13 lines
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +5 -0
                               pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
                                               pipe_ctx->stream_res.audio,
                                               pipe_ctx->stream->signal,
                                               &audio_output.crtc_info,
                                               &audio_output.pll_info);
+
+                             /* disable audio DTBCLK DTO */
+                             dc->res_pool->dccg->funcs->set_audio_dtbclk_dto(
+                                     dc->res_pool->dccg, &dto_params);
+
                       } else
                               pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
                                       pipe_ctx->stream_res.audio,

Maybe it is a good idea to add the Fixes tag that points to the commit that introduced this regression. Anyway, I'm ok with this change.

Quoted 7 lines

Or at least explain in what case you might hit it or an example backtrace.

Alex

Quoted 3 lines

Thanks Siqueira & Alex. I'll push with fixes tag and backtrace.