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 <[email protected]> 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/[email protected]?part=3
