From: sashiko-bot@kernel.org
To: "David Zhang" <yidong.zhang@amd.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V1 3/4] accel/amdxdna: Handle AIE4 firmware notifications
Date: Mon, 30 Nov 2026 01:48:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-240223@kernel.org> (raw)
In-Reply-To: <20261130014038.712239-4-yidong.zhang@amd.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] accel/amdxdna: integer overflow in mailbox_get_msg() [1]
--
commit 947637099961f0f7905dd904b64d8a95cfacaf39
Author: Nishad Saraf <nishad.saraf@amd.com>
accel/amdxdna: Handle AIE4 firmware notifications
This commit adds an optional mailbox handler for message ID 0 firmware
notifications and uses it on the AIE4 management channel to reset contexts on
context errors.
> diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdxdna/amdxdna_mailbox.c
> index c4701b2703d7b..cd65ca74077bd 100644
> --- a/drivers/accel/amdxdna/amdxdna_mailbox.c
> +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c
[ ... ]
> @@ -302,6 +304,15 @@ mailbox_get_resp(struct mailbox_channel *mb_chann, struct xdna_msg_header *heade
> u32 slot;
>
> msg_id = header->id;
> + if (!msg_id && mb_chann->async_cb) {
> + ret = mb_chann->async_cb(mb_chann->async_handle, header->opcode,
> + data, header->total_size);
[Severity: Critical]
This problem wasn't introduced by this patch, but can header.total_size
overflow msg_size in mailbox_get_msg() [1]?
drivers/accel/amdxdna/amdxdna_mailbox.c:mailbox_get_msg() {
...
header.total_size = readl(read_addr);
...
msg_size = sizeof(header) + header.total_size;
if (msg_size > ringbuf_size - head || msg_size > tail - head) {
MB_WARN_ONCE(mb_chann, "Invalid message size %d, tail %d, head %d",
msg_size, tail, head);
return -EINVAL;
}
...
}
If firmware supplies a large header.total_size (such as U32_MAX - 7), the
32-bit addition wraps to a small msg_size that passes the ring buffer bounds
checks, allowing out-of-bounds MMIO reads in mailbox_get_resp().
[1] https://sashiko.dev/#/bug/linux-651c2021-a4b0-4ec5-9ff6-66bd56f73027
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130014038.712239-1-yidong.zhang@amd.com?part=3
next prev parent reply other threads:[~2026-11-30 1:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 1:40 [PATCH V1 0/4] accel/amdxdna: Add AIE4 async events and TDR David Zhang
2026-11-30 1:40 ` [PATCH V1 1/4] accel/amdxdna: Add AIE4 async event buffers David Zhang
2026-11-30 1:40 ` [PATCH V1 2/4] accel/amdxdna: Add AIE4 context recovery David Zhang
2026-11-30 1:40 ` [PATCH V1 3/4] accel/amdxdna: Handle AIE4 firmware notifications David Zhang
2026-11-30 1:48 ` sashiko-bot [this message]
2026-11-30 1:40 ` [PATCH V1 4/4] accel/amdxdna: Recover hung AIE4 contexts David Zhang
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=sashiko-outbox-240223@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yidong.zhang@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 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.