Skip to content

Commit eba692c

Browse files
Austin Zhengalexdeucher
authored andcommitted
drm/amd/display: Call FP Protect Before Mode Programming/Mode Support
[Why] Memory allocation occurs within dml21_validate() for adding phantom planes. May cause kernel to be tainted due to usage of FP Start. [How] Move FP start from dml21_validate to before mode programming/mode support. Calculations requiring floating point are all done within mode programming or mode support. Reviewed-by: Alvin Lee <[email protected]> Signed-off-by: Austin Zheng <[email protected]> Signed-off-by: Ray Wu <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit fe3250f)
1 parent 2a24755 commit eba692c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_s
234234
if (!result)
235235
return false;
236236

237+
DC_FP_START();
237238
result = dml2_build_mode_programming(mode_programming);
239+
DC_FP_END();
238240
if (!result)
239241
return false;
240242

@@ -277,7 +279,9 @@ static bool dml21_check_mode_support(const struct dc *in_dc, struct dc_state *co
277279
mode_support->dml2_instance = dml_init->dml2_instance;
278280
dml21_map_dc_state_into_dml_display_cfg(in_dc, context, dml_ctx);
279281
dml_ctx->v21.mode_programming.dml2_instance->scratch.build_mode_programming_locals.mode_programming_params.programming = dml_ctx->v21.mode_programming.programming;
282+
DC_FP_START();
280283
is_supported = dml2_check_mode_supported(mode_support);
284+
DC_FP_END();
281285
if (!is_supported)
282286
return false;
283287

@@ -288,16 +292,12 @@ bool dml21_validate(const struct dc *in_dc, struct dc_state *context, struct dml
288292
{
289293
bool out = false;
290294

291-
DC_FP_START();
292-
293295
/* Use dml_validate_only for fast_validate path */
294296
if (fast_validate)
295297
out = dml21_check_mode_support(in_dc, context, dml_ctx);
296298
else
297299
out = dml21_mode_check_and_programming(in_dc, context, dml_ctx);
298300

299-
DC_FP_END();
300-
301301
return out;
302302
}
303303

0 commit comments

Comments
 (0)