Original amdgpu_cper_fini skips all CPER cleanup work for any SR-IOV VF 
directly.
When AMDGIM_FEATURE_RAS_CPER is enabled on VF side, CPER related 
buffers/workitems
are allocated during initialization, but the old code returns early without
releasing these resources, which leads to kernel memory leak.

Signed-off-by: Ce Sun <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c
index 0af8b7be326e..373e47050630 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c
@@ -519,7 +519,7 @@ int amdgpu_cper_deferred_init(struct amdgpu_device *adev)
 
 int amdgpu_cper_fini(struct amdgpu_device *adev)
 {
-       if (amdgpu_sriov_vf(adev))
+       if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_ras_cper_en(adev))
                return 0;
 
        adev->cper.enabled = false;
-- 
2.34.1

Reply via email to