drm/amd/pm: fix a double-free in si_dpm_init
authorZhipeng Lu <alexious@zju.edu.cn>
Thu, 14 Dec 2023 15:24:11 +0000 (23:24 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 14 Dec 2023 20:28:15 +0000 (15:28 -0500)
commitac16667237a82e2597e329eb9bc520d1cf9dff30
tree6b53f57bbc2ecf3eb88ade7a909e6fea7bcfaf60
parent804c49ef30735d70c1df0c58ebec313149a3933c
drm/amd/pm: fix a double-free in si_dpm_init

When the allocation of
adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries fails,
amdgpu_free_extended_power_table is called to free some fields of adev.
However, when the control flow returns to si_dpm_sw_init, it goes to
label dpm_failed and calls si_dpm_fini, which calls
amdgpu_free_extended_power_table again and free those fields again. Thus
a double-free is triggered.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c