From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/amdxdna: Validate command buffer payload count
Date: Mon, 23 Feb 2026 06:27:49 +1000 [thread overview]
Message-ID: <review-overall-20260219211946.1920485-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260219211946.1920485-1-lizhi.hou@amd.com>
Overall Series Review
Subject: accel/amdxdna: Validate command buffer payload count
Author: Lizhi Hou <lizhi.hou@amd.com>
Patches: 2
Reviewed: 2026-02-23T06:27:49.749404
---
This is a single patch fixing a buffer overread vulnerability in the amdxdna accelerator driver. The `amdxdna_cmd_get_payload()` function reads a `count` field from a command header embedded in a GEM buffer object and uses it to calculate the payload size. Before this fix, the function only checked that `count > num_masks` but did not verify that the total claimed size fits within the underlying buffer. A malicious or corrupted command buffer could set a `count` value that passes the existing check but extends past the end of the allocated buffer, leading to an out-of-bounds read when callers copy or process the payload.
The fix adds a second condition to the existing validation, checking that `count * sizeof(u32) + offsetof(struct amdxdna_cmd, data[0])` does not exceed `abo->mem.size`. The arithmetic is safe from overflow since `count` is extracted from an 11-bit field (GENMASK(22, 12), max 2047), and the entire expression evaluates in `size_t` due to `sizeof(u32)` promoting the operands. The fix is minimal and targeted.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-02-22 20:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 21:19 [PATCH V1] accel/amdxdna: Validate command buffer payload count Lizhi Hou
2026-02-20 17:03 ` Mario Limonciello (AMD) (kernel.org)
2026-02-22 20:27 ` Claude Code Review Bot [this message]
2026-02-22 20:27 ` Claude review: " Claude Code Review 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=review-overall-20260219211946.1920485-1-lizhi.hou@amd.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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