aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
diff options
context:
space:
mode:
authorKeita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>2022-04-19 10:37:19 +0000
committerAlex Deucher <alexander.deucher@amd.com>2022-04-19 13:58:32 -0400
commitf3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd (patch)
tree579b0a1ab9f73cee48eb2e1170da8975d5992579 /drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
parenta26b9e0b9b153ace311245c8357715cb7ff0b727 (diff)
downloadlinux-f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd.tar.gz
linux-f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd.tar.bz2
linux-f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd.zip
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c')
0 files changed, 0 insertions, 0 deletions