AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed
@ 2020-06-16  6:30 Chen Tao
  2020-06-16  6:30 ` [PATCH 2/2] drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed Chen Tao
  2020-06-16  6:50 ` [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed Christian König
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Tao @ 2020-06-16  6:30 UTC (permalink / raw)
  To: airlied, daniel
  Cc: tom.stdenis, David1.Zhou, Jack.Xiao, linux-kernel, amd-gfx,
	chentao107, dri-devel, alexander.deucher, christian.koenig, yttao

Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
pm_runtime_get_sync failed.

Fixes: a9ffe2a983383 ("drm/amdgpu/debugfs: properly handle runtime pm")
Signed-off-by: Chen Tao <chentao107@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 1a4894fa3693..bea8c36a53a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -862,8 +862,10 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
 		return -ENOMEM;
 
 	r = pm_runtime_get_sync(adev->ddev->dev);
-	if (r < 0)
+	if (r < 0) {
+		kfree(data);
 		return r;
+	}
 
 	r = amdgpu_virt_enable_access_debugfs(adev);
 	if (r < 0)
-- 
2.22.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed
@ 2020-06-16 11:23 Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2020-06-16 11:23 UTC (permalink / raw)
  To: Chen Tao, amd-gfx, dri-devel
  Cc: Tom St Denis, Chunming Zhou, Jack Xiao, Daniel Vetter,
	David Airlie, Kangjie Lu, kernel-janitors, linux-kernel,
	Navid Emamdoost, Qiushi Wu, Aditya Pakki, Alex Deucher,
	Christian König, Yintian Tao

> Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
> pm_runtime_get_sync failed.

* Would you like to improve the exception handling any more for this software module?

* How do you think about calling the function “pm_runtime_put_noidle”?

Regards,
Markus
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-16 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-16  6:30 [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed Chen Tao
2020-06-16  6:30 ` [PATCH 2/2] drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed Chen Tao
2020-06-16  6:50 ` [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed Christian König
2020-06-16 11:04   ` chentao (AS)
  -- strict thread matches above, loose matches on Subject: below --
2020-06-16 11:23 Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox