From: Mario Limonciello <superm1@kernel.org>
To: "Wentao Liang" <vulab@iscas.ac.cn>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: Lijo Lazar <lijo.lazar@amd.com>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Xiaogang Chen <xiaogang.chen@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v4] drm/amdgpu: Fix resource leak in amdgpu_gfx_run_cleaner_shader_job()
Date: Sat, 27 Jun 2026 00:53:51 -0500 [thread overview]
Message-ID: <9f91ba0b-519b-48f3-822e-a2b08d7e6feb@kernel.org> (raw)
In-Reply-To: <20260624124731.37479-1-vulab@iscas.ac.cn>
On 6/24/26 07:47, Wentao Liang wrote:
> When amdgpu_job_alloc_with_ib() fails in
> amdgpu_gfx_run_cleaner_shader_job(), the function returns directly
> without destroying the scheduler entity, causing a resource leak.
>
> Fix this by moving the entity cleanup to a common error path. Set r = 0
> on success and use a single cleanup point at the err label to ensure the
> entity is always destroyed regardless of whether the function succeeds
> or fails.
>
> Also remove the unnecessary error check for dma_fence_wait() since it
> never fails with intr=false and infinite timeout.
>
> Cc: stable@vger.kernel.org
> Fixes: 559a285816af ("drm/amdgpu: Replace 'amdgpu_job_submit_direct' with 'drm_sched_entity' in cleaner shader")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 523b681d0da9..29a07af6f5f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -1689,9 +1689,7 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
>
> dma_fence_put(f);
>
> - /* Clean up the scheduler entity */
> - drm_sched_entity_destroy(&entity);
> - return 0;
> + r = 0;
>
> err:
> /* Clean up the scheduler entity */
What tree is this against? It doesn't apply against amd-staging-drm-next.
Applying: drm/amdgpu: Fix resource leak in
amdgpu_gfx_run_cleaner_shader_job()
Patch failed at 0001 drm/amdgpu: Fix resource leak in
amdgpu_gfx_run_cleaner_shader_job()
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
error: patch failed: drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1689
error: drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
prev parent reply other threads:[~2026-06-27 5:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 12:47 Wentao Liang
2026-06-27 5:53 ` Mario Limonciello [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=9f91ba0b-519b-48f3-822e-a2b08d7e6feb@kernel.org \
--to=superm1@kernel.org \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
--cc=xiaogang.chen@amd.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
Powered by JetHome