mirror_ubuntu-kernels/drivers/gpu/drm/amd/pm/legacy-dpm
Zhipeng Lu a658270117 drm/amd/pm: fix a double-free in amdgpu_parse_extended_power_table
The amdgpu_free_extended_power_table is called in every error-handling
paths of amdgpu_parse_extended_power_table. However, after the following
call chain of returning:

amdgpu_parse_extended_power_table
  |-> kv_dpm_init / si_dpm_init
      (the only two caller of amdgpu_parse_extended_power_table)
        |-> kv_dpm_sw_init / si_dpm_sw_init
            (the only caller of kv_dpm_init / si_dpm_init, accordingly)
              |-> kv_dpm_fini / si_dpm_fini
                  (goto dpm_failed in xx_dpm_sw_init)
                    |-> amdgpu_free_extended_power_table

As above, the amdgpu_free_extended_power_table is called twice in this
returning chain and thus a double-free is triggered. Similarily, the
last kfree in amdgpu_parse_extended_power_table also cause a double free
with amdgpu_free_extended_power_table in kv_dpm_fini.

Fixes: 84176663e7 ("drm/amd/pm: create a new holder for those APIs used only by legacy ASICs(si/kv)")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-12-14 15:29:08 -05:00
..
cik_dpm.h
kv_dpm.c drivers/amd/pm: fix a use-after-free in kv_parse_power_table 2023-12-14 15:28:39 -05:00
kv_dpm.h
kv_smc.c
legacy_dpm.c drm/amd/pm: fix a double-free in amdgpu_parse_extended_power_table 2023-12-14 15:29:08 -05:00
legacy_dpm.h
Makefile
ppsmc.h
r600_dpm.h drm/amd/pm: Clean up errors in r600_dpm.h 2023-08-09 09:42:42 -04:00
si_dpm.c drm/amd/pm: fix a double-free in si_dpm_init 2023-12-14 15:28:15 -05:00
si_dpm.h
si_smc.c
sislands_smc.h drm/amd/pm: Clean up errors in sislands_smc.h 2023-08-09 09:42:44 -04:00