linux/drivers/gpu/drm/amd/pm
Keita Suzuki f3fa2becf2 drm/amd/pm: fix double free in si_parse_power_table()
In function si_parse_power_table(), array adev->pm.dpm.ps and its member
is allocated. If the allocation of each member fails, the array itself
is freed and returned with an error code. However, the array is later
freed again in si_dpm_fini() function which is called when the function
returns an error.

This leads to potential double free of the array adev->pm.dpm.ps, as
well as leak of its array members, since the members are not freed in
the allocation function and the array is not nulled when freed.
In addition adev->pm.dpm.num_ps, which keeps track of the allocated
array member, is not updated until the member allocation is
successfully finished, this could also lead to either use after free,
or uninitialized variable access in si_dpm_fini().

Fix this by postponing the free of the array until si_dpm_fini() and
increment adev->pm.dpm.num_ps everytime the array member is allocated.

Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2022-04-19 13:58:32 -04:00
..
inc drm/amdgpu: expand cg_flags from u32 to u64 2022-04-08 17:24:24 -04:00
legacy-dpm drm/amd/pm: fix double free in si_parse_power_table() 2022-04-19 13:58:32 -04:00
powerplay drm/amdgpu/smu10: fix SoC/fclk units in auto mode 2022-04-06 10:20:45 -04:00
swsmu amdgpu/pm: Clarify documentation of error handling in send_smc_mesg 2022-04-19 13:58:32 -04:00
amdgpu_dpm.c drm/amdgpu/pm: fix the null pointer while the smu is disabled 2022-04-19 13:58:32 -04:00
amdgpu_dpm_internal.c drm/amd/pm: add missing prototypes to amdgpu_dpm_internal 2022-02-07 18:03:50 -05:00
amdgpu_pm.c drm/amdgpu: expand cg_flags from u32 to u64 2022-04-08 17:24:24 -04:00
Makefile drm/amd/pm: relocate the power related headers 2022-01-14 17:51:14 -05:00