* [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; 4+ messages in thread
From: Chen Tao @ 2020-06-16 6:30 UTC (permalink / raw)
To: airlied, daniel
Cc: alexander.deucher, christian.koenig, David1.Zhou, tom.stdenis,
Jack.Xiao, yttao, amd-gfx, dri-devel, linux-kernel, chentao107
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed
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 ` 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
1 sibling, 0 replies; 4+ messages in thread
From: Chen Tao @ 2020-06-16 6:30 UTC (permalink / raw)
To: airlied, daniel
Cc: alexander.deucher, christian.koenig, David1.Zhou, tom.stdenis,
Jack.Xiao, yttao, amd-gfx, dri-devel, linux-kernel, chentao107
Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
amdgpu_virt_enable_access_debugfs failed.
Fixes: 95a2f917387a2 ("drm/amdgpu: restrict debugfs register accessunder SR-IOV")
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 bea8c36a53a4..f66ee4b8f04e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -868,8 +868,10 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
}
r = amdgpu_virt_enable_access_debugfs(adev);
- if (r < 0)
+ if (r < 0) {
+ kfree(data);
return r;
+ }
/* switch to the specific se/sh/cu */
mutex_lock(&adev->grbm_idx_mutex);
--
2.22.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed
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 ` Christian König
2020-06-16 11:04 ` chentao (AS)
1 sibling, 1 reply; 4+ messages in thread
From: Christian König @ 2020-06-16 6:50 UTC (permalink / raw)
To: Chen Tao, airlied, daniel
Cc: alexander.deucher, David1.Zhou, tom.stdenis, Jack.Xiao, yttao,
amd-gfx, dri-devel, linux-kernel
Am 16.06.20 um 08:30 schrieb Chen Tao:
> 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>
Probably better to remove the duplication of result and r here and then
use "goto err".
Regards,
Christian
> ---
> 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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed
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)
0 siblings, 0 replies; 4+ messages in thread
From: chentao (AS) @ 2020-06-16 11:04 UTC (permalink / raw)
To: Christian König, airlied, daniel
Cc: alexander.deucher, David1.Zhou, tom.stdenis, Jack.Xiao, yttao,
amd-gfx, dri-devel, linux-kernel
Ok, i will modify it in v2 patch.
On 2020/6/16 14:50, Christian König wrote:
> Probably better to remove the duplication of result and r here and
> then use "goto err".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-16 11:04 UTC | newest]
Thread overview: 4+ 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)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).