Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eac3e476 authored by Wayne Lin's avatar Wayne Lin Committed by Greg Kroah-Hartman
Browse files

drm/amd/display: Avoid NULL dereference of timing generator



[ Upstream commit b1904ed480cee3f9f4036ea0e36d139cb5fee2d6 ]

[Why & How]
Check whether assigned timing generator is NULL or not before
accessing its funcs to prevent NULL dereference.

Reviewed-by: default avatarJun Lei <jun.lei@amd.com>
Acked-by: default avatarHersen Wu <hersenxs.wu@amd.com>
Signed-off-by: default avatarWayne Lin <wayne.lin@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 514565ff
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream)
	for (i = 0; i < MAX_PIPES; i++) {
		struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg;

		if (res_ctx->pipe_ctx[i].stream != stream)
		if (res_ctx->pipe_ctx[i].stream != stream || !tg)
			continue;

		return tg->funcs->get_frame_count(tg);
@@ -551,7 +551,7 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
	for (i = 0; i < MAX_PIPES; i++) {
		struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg;

		if (res_ctx->pipe_ctx[i].stream != stream)
		if (res_ctx->pipe_ctx[i].stream != stream || !tg)
			continue;

		tg->funcs->get_scanoutpos(tg,