drm/amd/display: fix a bug to dereference already freed old current state memory
authorWenjing Liu <wenjing.liu@amd.com>
Mon, 4 Mar 2024 23:16:43 +0000 (18:16 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 22 Mar 2024 19:50:44 +0000 (15:50 -0400)
commit621cf07a3f25337b17becd4c9486308c0988ea49
treef7d44ac944297815b7cdfbb6723d356e561e9fe7
parent9ddafd1d140441d288d3fc376d2809995ce504b7
drm/amd/display: fix a bug to dereference already freed old current state memory

[why]
During minimal transition commit, the base state could be freed if it is current state.
This is because after committing minimal transition state, the current state will be
swapped to the minimal transition state and the old current state will be released.
the release could cause the old current state's memory to be freed. However dc
will derefernce this memory when release minimal transition state. Therefore, we
need to retain the old current state until we release minimal transition state.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Reviewed-by: Josip Pavic <josip.pavic@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c