From: Deniz Aydogan <denizaydogan1902@gmail.com>
To: lizhi.hou@amd.com, amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Deniz Aydogan <denizaydogan1902@gmail.com>
Subject: [PATCH v2] accel/amdxdna: add NULL check for job->cmd_bo
Date: Wed, 2 Sep 2026 14:49:59 +0300 [thread overview]
Message-ID: <20260902114959.9553-1-denizaydogan1902@gmail.com> (raw)
In-Reply-To: <20260829080016.10002-1-denizaydogan1902@gmail.com>
amdxdna_cmd_submit() leaves job->cmd_bo as NULL for internal driver
commands that use AMDXDNA_INVALID_BO_HANDLE. The cleanup paths in
amdxdna_cmd_submit() error handling and amdxdna_sched_job_cleanup()
call amdxdna_gem_put_obj(job->cmd_bo) unconditionally.
Although drm_gem_object_put() handles NULL, adding an explicit check
makes the code more robust and easier to reason about.
Signed-off-by: Deniz Aydogan <denizaydogan1902@gmail.com>
---
drivers/accel/amdxdna/amdxdna_ctx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c
index 31a414c3f..21f0560e6 100644
--- a/drivers/accel/amdxdna/amdxdna_ctx.c
+++ b/drivers/accel/amdxdna/amdxdna_ctx.c
@@ -575,7 +575,8 @@ void amdxdna_sched_job_cleanup(struct amdxdna_sched_job *job)
trace_amdxdna_debug_point(job->hwctx->name, job->seq, "job release");
amdxdna_pm_suspend_put(job->hwctx->client->xdna);
amdxdna_arg_bos_put(job);
- amdxdna_gem_put_obj(job->cmd_bo);
+ if (job->cmd_bo)
+ amdxdna_gem_put_obj(job->cmd_bo);
dma_fence_put(job->fence);
mmdrop(job->mm);
}
@@ -676,7 +677,8 @@ int amdxdna_cmd_submit(struct amdxdna_client *client,
put_bos:
amdxdna_arg_bos_put(job);
cmd_put:
- amdxdna_gem_put_obj(job->cmd_bo);
+ if (job->cmd_bo)
+ amdxdna_gem_put_obj(job->cmd_bo);
free_job:
if (job->mm)
mmdrop(job->mm);
--
2.55.0
prev parent reply other threads:[~2026-09-02 11:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 8:00 [PATCH] accel/amdxdna: fix NULL deref and GEM object leak in error paths Deniz Aydogan
2026-08-29 8:56 ` [PATCH v2] " Deniz Aydogan
2026-08-31 20:38 ` Lizhi Hou
2026-09-02 11:49 ` Deniz Aydogan [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=20260902114959.9553-1-denizaydogan1902@gmail.com \
--to=denizaydogan1902@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@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
all inboxes | Powered by JetHome®