From: sashiko-bot@kernel.org
To: "Taimuraz Kaitmazov" <taimuraz@kaitmazov.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] accel/amdxdna: put the chained BO when its mapping fails
Date: Wed, 19 Aug 2026 23:19:22 +0000 [thread overview]
Message-ID: <20260819231923.2B3DB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819230721.287529-1-taimuraz@kaitmazov.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Kernel panic via `__counted_by` array bounds violation when userspace supplies `command_count == 0`.
--
--- Patch [1]: [PATCH] accel/amdxdna: put the chained BO when its mapping fails ---
commit 78a13180a3a2715c4d150e03603955519d45a53a
Author: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>
accel/amdxdna: put the chained BO when its mapping fails
This commit fixes a reference leak in amdxdna_cmd_set_error(). When the
chained BO fails to map, the previously acquired reference on the BO is now
properly dropped.
> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c
> index 31a414c3f0d96..888e857ec5582 100644
> --- a/drivers/accel/amdxdna/amdxdna_ctx.c
> +++ b/drivers/accel/amdxdna/amdxdna_ctx.c
> @@ -183,8 +183,10 @@ int amdxdna_cmd_set_error(struct amdxdna_gem_obj *abo,
> if (!abo)
> return -EINVAL;
[Severity: Critical]
This is a pre-existing issue, but does this code unconditionally access
cc->data[0] before reaching here?
Looking slightly above this diff hunk in amdxdna_cmd_set_error():
if (amdxdna_cmd_get_op(abo) == ERT_CMD_CHAIN) {
cc = amdxdna_cmd_get_payload(abo, NULL);
cc->error_index = (cmd_idx < cc->command_count) ? cmd_idx : 0;
abo = amdxdna_gem_get_obj(client, cc->data[0], AMDXDNA_BO_SHARE);
Because the data flexible array member in struct amdxdna_cmd_chain is
annotated with __counted_by(command_count), accessing cc->data[0] when
command_count is 0 will result in an array bounds violation.
Can a user intentionally trigger a kernel panic and a local denial of service
by submitting a crafted ERT_CMD_CHAIN with command_count == 0 that later times
out or fails?
> cmd = amdxdna_gem_vmap(abo);
> - if (!cmd)
> + if (!cmd) {
> + amdxdna_gem_put_obj(abo);
> return -ENOMEM;
> + }
> }
>
> memset(cmd->data, 0xff, abo->mem.size - sizeof(*cmd));
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819230721.287529-1-taimuraz@kaitmazov.com?part=1
next prev parent reply other threads:[~2026-08-19 23:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 23:07 [PATCH] accel/amdxdna: put the chained BO when its mapping fails Taimuraz Kaitmazov
2026-08-19 23:19 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-08-19 23:08 Taimuraz Kaitmazov
2026-08-19 23:22 ` sashiko-bot
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=20260819231923.2B3DB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=taimuraz@kaitmazov.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.