dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Doruk Tan Ozturk <doruk@0sec.ai>, Min Ma <mamin506@gmail.com>,
	Oded Gabbay <ogabbay@kernel.org>
Cc: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] accel/amdxdna: reject command submission on devices without a submit op
Date: Wed, 15 Jul 2026 02:25:57 -0700	[thread overview]
Message-ID: <c2c57689-ee6d-99cd-2d96-da95f2876a60@amd.com> (raw)
In-Reply-To: <78c05949-61a8-9737-3642-289c8921e2d7@amd.com>

Applied to drm-misc-fixes

On 7/14/26 18:00, Lizhi Hou wrote:
>
> On 7/13/26 10:30, Doruk Tan Ozturk wrote:
>> amdxdna_cmd_submit() calls xdna->dev_info->ops->cmd_submit()
>> unconditionally, but only aie2_dev_ops defines that callback.
>> aie4_vf_ops (the AIE4 SR-IOV virtual function) does not, so a user
>> AMDXDNA_EXEC_CMD ioctl on an AIE4 device reaches a NULL function-pointer
>> call and oopses the kernel. AIE4 submits work through a mapped user 
>> queue
>> and doorbell, not this ioctl path.
>>
>> Reject the submission early with -EOPNOTSUPP when the device provides no
>> cmd_submit op, so the shared EXEC ioctl is a clean no-op on such 
>> devices.
>>
>> Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
>> Cc: stable@vger.kernel.org
>> Found by 0sec automated security-research tooling (https://0sec.ai).
>> Assisted-by: 0sec:claude-opus-4-8
>> Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
>> ---
>>   drivers/accel/amdxdna/amdxdna_ctx.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c 
>> b/drivers/accel/amdxdna/amdxdna_ctx.c
>> index a5c8c2c4de6d..bdbd3db12a6c 100644
>> --- a/drivers/accel/amdxdna/amdxdna_ctx.c
>> +++ b/drivers/accel/amdxdna/amdxdna_ctx.c
>> @@ -590,6 +590,10 @@ int amdxdna_cmd_submit(struct amdxdna_client 
>> *client,
>>       int ret, idx;
>>         XDNA_DBG(xdna, "Command BO hdl %d, Arg BO count %d", 
>> cmd_bo_hdl, arg_bo_cnt);
>> +
>> +    if (!xdna->dev_info->ops->cmd_submit)
>> +        return -EOPNOTSUPP;
>> +
> Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
>>       job = kzalloc_flex(*job, bos, arg_bo_cnt);
>>       if (!job)
>>           return -ENOMEM;

      reply	other threads:[~2026-07-15  9:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 17:30 [PATCH 0/2] accel/amdxdna: fix two NULL-deref DoS paths reachable via AMDXDNA_EXEC_CMD Doruk Tan Ozturk
2026-07-13 17:30 ` [PATCH 1/2] accel/amdxdna: reject user command submission without a command BO Doruk Tan Ozturk
2026-07-13 17:55   ` sashiko-bot
2026-07-15  0:58   ` Lizhi Hou
2026-07-15  9:25     ` Lizhi Hou
2026-07-13 17:30 ` [PATCH 2/2] accel/amdxdna: reject command submission on devices without a submit op Doruk Tan Ozturk
2026-07-15  1:00   ` Lizhi Hou
2026-07-15  9:25     ` Lizhi Hou [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=c2c57689-ee6d-99cd-2d96-da95f2876a60@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=doruk@0sec.ai \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mamin506@gmail.com \
    --cc=ogabbay@kernel.org \
    --cc=stable@vger.kernel.org \
    /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