Skip to contentSkip to conversation

drm/amdgpu: Fix double runtime PM put in amdgpu_debugfs_gpr_read()

PATCH New [email protected] 1 participant 1 message Oct 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix double runtime PM put in amdgpu_debugfs_gpr_read()

From: Lu Yao <[email protected]>

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")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -1
index aca1a8045afa..7a3246852efb 100644
@@ -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;
Signature · 1 line
2.25.1