mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Dong Chenchen <dongchenchen2@huawei.com>,
	airlied@gmail.com, daniel@ffwll.ch
Cc: alexander.deucher@amd.com, Xinhui.Pan@amd.com,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, yuehaibing@huawei.com
Subject: Re: [PATCH] drm/amdgpu: Fix memory leak in amdgpu_cs_pass1
Date: Fri, 11 Nov 2022 12:57:23 +0100	[thread overview]
Message-ID: <22a00fd8-2489-d803-bea4-e624c355a984@amd.com> (raw)
In-Reply-To: <20221110143314.708434-1-dongchenchen2@huawei.com>

Am 10.11.22 um 15:33 schrieb Dong Chenchen:
> When p->gang_size equals 0, amdgpu_cs_pass1() will return directly
> without freeing chunk_array, which will cause a memory leak issue,
> this patch fixes it.
>
> Fixes: 4624459c84d7 ("drm/amdgpu: add gang submit frontend v6")
> Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com>

Good catch, thanks. Patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 1bbd39b3b0fc..0e24d6b80e0b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -287,8 +287,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
>   		}
>   	}
>   
> -	if (!p->gang_size)
> -		return -EINVAL;
> +	if (!p->gang_size) {
> +		ret = -EINVAL;
> +		goto free_partial_kdata;
> +	}
>   
>   	for (i = 0; i < p->gang_size; ++i) {
>   		ret = amdgpu_job_alloc(p->adev, num_ibs[i], &p->jobs[i], vm);


      parent reply	other threads:[~2022-11-11 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:33 Dong Chenchen
2022-11-10 18:07 ` Luben Tuikov
2022-11-10 19:53   ` Alex Deucher
2022-11-11 11:57 ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22a00fd8-2489-d803-bea4-e624c355a984@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    --cc=dongchenchen2@huawei.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®