]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amd/ras: Fix CPER ring debugfs read overflow
authorXiang Liu <xiang.liu@amd.com>
Thu, 7 May 2026 12:56:15 +0000 (20:56 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 May 2026 21:54:28 +0000 (17:54 -0400)
commit6bbede02dc62a1021aeeae87ab243bd7a93c61d2
tree8745a2cfaa92bbe317aae20db1852fbe24c9fa5f
parent183182235f6d53bac62c6c39014738a54a68dfa6
drm/amd/ras: Fix CPER ring debugfs read overflow

The legacy CPER debugfs reader can reach the payload path without a
valid pointer snapshot. The remaining user byte count is also treated as
the ring occupancy in dwords, so reads past the header can copy more than
requested.

Take the CPER lock before sampling pointers. Resample rptr/wptr for
payload reads, bound the payload copy by available dwords and the
remaining user size, and advance the file position for each dword copied.

Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 1e40ef87ffdc291e05ccdade8b9170cc9c1c4249)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c