]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amd/pm: fix pptable use-after-free
authorYang Wang <kevinyang.wang@amd.com>
Thu, 23 Jul 2026 23:41:29 +0000 (07:41 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Jul 2026 23:59:59 +0000 (19:59 -0400)
commitbb493058c35c8676e48269ab6732688ea733d23c
tree84c9712a3dbe6e0042f90e9ed3f98d5cfc5c681a
parentc2ac5a50c1804e22d5bc05c7e16693333751b3c0
drm/amd/pm: fix pptable use-after-free

amdgpu_dpm_get_pp_table() returns a pointer to a driver-owned power table
after dropping adev->pm.mutex. The sysfs path then copies from that pointer.
A concurrent pp_table write can replace and free the allocation during the
copy, causing a use-after-free.

Change the DPM interface to copy into caller-provided storage while the mutex
is held. Keep the size-only query for attribute discovery without exposing
the driver-owned pointer.

Fixes: 1684d3ba4885 ("drm/amd/amdgpu: change pptable output format from ASCII to binary")
Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f6eed7acfd30099ef7baeb6ba45bb59daad80631)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/pm/amdgpu_dpm.c
drivers/gpu/drm/amd/pm/amdgpu_pm.c
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h