mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Max Zhen <max.zhen@amd.com>, <ogabbay@kernel.org>,
	<quic_jhugo@quicinc.com>, <dri-devel@lists.freedesktop.org>,
	<mario.limonciello@amd.com>, <karol.wachowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Remove __counted_by from struct amdxdna_cmd_chain
Date: Mon, 24 Aug 2026 09:39:47 -0700	[thread overview]
Message-ID: <545b0402-18cd-7a2e-3be2-8fd2335fae98@amd.com> (raw)
In-Reply-To: <7ce13e6d-0da6-4d6c-a05b-3ad5e67499f4@amd.com>

Applied to drm-misc-fixes.

On 8/21/26 10:50, Max Zhen wrote:
>
>
> On 8/20/2026 Thu 20:35, Lizhi Hou wrote:
>> struct amdxdna_cmd_chain contains a flexible array annotated with
>> __counted_by(command_count). Since the structure is stored in shared
>> AMDXDNA_BO_SHARE memory, userspace can modify command_count 
>> concurrently.
>> If command_count is changed to zero, the bounds check generated from
>> __counted_by may fail and trigger a kernel panic.
>>
>> Remove __counted_by to avoid relying on the userspace-controlled
>> command_count for the flexible array bounds check.
>>
>> Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> Reviewed-by: Max Zhen <max.zhen@amd.com>
>> ---
>>   drivers/accel/amdxdna/amdxdna_ctx.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.h 
>> b/drivers/accel/amdxdna/amdxdna_ctx.h
>> index e6155f4b5db0..010538cb05a3 100644
>> --- a/drivers/accel/amdxdna/amdxdna_ctx.h
>> +++ b/drivers/accel/amdxdna/amdxdna_ctx.h
>> @@ -56,7 +56,7 @@ struct amdxdna_cmd_chain {
>>       u32 submit_index;
>>       u32 error_index;
>>       u32 reserved[3];
>> -    u64 data[] __counted_by(command_count);
>> +    u64 data[];
>>   };
>>     /*
>

      reply	other threads:[~2026-08-24 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  3:35 Lizhi Hou
2026-08-21 17:50 ` Max Zhen
2026-08-24 16:39   ` 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=545b0402-18cd-7a2e-3be2-8fd2335fae98@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®