From: Xiang Liu Date: Fri, 28 Feb 2025 03:11:08 +0000 (+0800) Subject: drm/amdgpu: Free CPER entry after committing to ring X-Git-Tag: v6.15-rc1~120^2~12^2~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=677ae51f4901e22517f8291a0263f794c104e167;p=thirdparty%2Flinux.git drm/amdgpu: Free CPER entry after committing to ring Free CPER entry when it's committed to CPER ring to avoid memory leak. Signed-off-by: Xiang Liu Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c index 15cd0a007b716..0415ed222342d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c @@ -301,6 +301,7 @@ int amdgpu_cper_generate_ue_record(struct amdgpu_device *adev, return ret; amdgpu_cper_ring_write(ring, fatal, fatal->record_length); + kfree(fatal); return 0; } @@ -323,6 +324,7 @@ int amdgpu_cper_generate_bp_threshold_record(struct amdgpu_device *adev) return ret; amdgpu_cper_ring_write(ring, bp_threshold, bp_threshold->record_length); + kfree(bp_threshold); return 0; } @@ -399,6 +401,7 @@ int amdgpu_cper_generate_ce_records(struct amdgpu_device *adev, } amdgpu_cper_ring_write(ring, corrected, corrected->record_length); + kfree(corrected); return 0; }