[PATCH] drm/amdgpu: Fix double runtime PM put in amdgpu_debugfs_gpr_read()
From: yaolu
Date: Sat Oct 03 2026 - 22:47:21 EST
From: Lu Yao <yaolu@xxxxxxxxxx>
If put_user() failed in loop, jumping to err label will cause putting
the reference a second time.
Fixes: 9eee152aab56 ("drm/amdgpu/debugfs: fix ref count leak when pm_runtime_get_sync fails")
Signed-off-by: Lu Yao <yaolu@xxxxxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index aca1a8045afa..7a3246852efb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1302,8 +1302,9 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
value = data[result >> 2];
r = put_user(value, (uint32_t *)buf);
if (r) {
+ kfree(data);
amdgpu_virt_disable_access_debugfs(adev);
- goto err;
+ return r;
}
result += 4;
--
2.25.1