lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8fb3d27-d0f5-d28a-d24b-63be866ef76f@amd.com>
Date:   Tue, 16 Jun 2020 08:50:20 +0200
From:   Christian König <christian.koenig@....com>
To:     Chen Tao <chentao107@...wei.com>, airlied@...ux.ie, daniel@...ll.ch
Cc:     alexander.deucher@....com, David1.Zhou@....com,
        tom.stdenis@....com, Jack.Xiao@....com, yttao@....com,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when
 pm_runtime_get_sync failed

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@...wei.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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ