]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: Add 'replay' NULL check in 'edp_set_replay_allow_active()'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Thu, 15 Feb 2024 13:08:16 +0000 (18:38 +0530)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:49 +0000 (18:19 -0400)
commitf610c46771ef1047e46d61807aa7c69cd29e63d8
treea458a97eec8544865620c1ae2ebd9a0bbbca6adb
parent8863d8097a0f7fae875fcb7eb5332f364e827d3c
drm/amd/display: Add 'replay' NULL check in 'edp_set_replay_allow_active()'

[ Upstream commit f6aed043ee5d75b3d1bfc452b1a9584b63c8f76b ]

In the first if statement, we're checking if 'replay' is NULL. But in
the second if statement, we're not checking if 'replay' is NULL again
before calling replay->funcs->replay_set_power_opt().

if (replay == NULL && force_static)
    return false;

...

if (link->replay_settings.replay_feature_enabled &&
    replay->funcs->replay_set_power_opt) {
replay->funcs->replay_set_power_opt(replay, *power_opts, panel_inst);
link->replay_settings.replay_power_opt_active = *power_opts;
}

If 'replay' is NULL, this will cause a null pointer dereference.

Fixes the below found by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:895 edp_set_replay_allow_active() error: we previously assumed 'replay' could be null (see line 887)

Fixes: c7ddc0a800bc ("drm/amd/display: Add Functions to enable Freesync Panel Replay")
Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Suggested-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c