All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andre Luiz Batista Bueno" <andrebueno.mac@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V2 RESEND] drm/amdgpu: deduplicate JPEG v5.0 interrupt routine
Date: Wed, 24 Jun 2026 07:56:59 +0000	[thread overview]
Message-ID: <20260624075659.E17921F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624033134.145561-1-andrebueno.mac@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Potential out-of-bounds array access when indexing `node_id_to_phys_map` with unvalidated `entry->node_id`.
--

commit 9ee6645118b792b4fedbe83c62cc09cc3bce36b1
Author: Andre Luiz Batista Bueno <andrebueno.mac@gmail.com>

drm/amdgpu: deduplicate JPEG v5.0 interrupt routine

This commit deduplicates identical interrupt processing routines in
jpeg_v5_0_1.c and jpeg_v5_0_2.c. It updates jpeg_v5_0_1_process_interrupt()
to be non-static and calls it directly from the jpeg_v5_0_2 interrupt
handlers to avoid code duplication.

> diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c
> index 250316704dfac..2b8d8f4ca30d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c
> @@ -755,7 +755,7 @@ static int jpeg_v5_0_1_set_ras_interrupt_state(struct amdgpu_device *adev,
>  
>  
>  
> -static int jpeg_v5_0_1_process_interrupt(struct amdgpu_device *adev,
> +int jpeg_v5_0_1_process_interrupt(struct amdgpu_device *adev,
>  					 struct amdgpu_irq_src *source,
>  					 struct amdgpu_iv_entry *entry)
>  {

[Severity: High]
This is a pre-existing issue, but does this function lack bounds checking on
entry->node_id before using it as an array index?

When the interrupt vector is read from the hardware-writeable IH ring,
entry->node_id can be an 8-bit value (0-255). Looking at how this is
handled inside jpeg_v5_0_1_process_interrupt():

int jpeg_v5_0_1_process_interrupt(...)
{
	u32 i, inst;

	i = node_id_to_phys_map[entry->node_id];
        ...
}

Could a malicious or malfunctioning PCIe device supply an interrupt vector
with a node_id >= NODEID_MAX (15), leading to an out-of-bounds read of up to
1020 bytes past the end of the node_id_to_phys_map array and a potential
kernel panic?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260624033134.145561-1-andrebueno.mac@gmail.com?part=1

      reply	other threads:[~2026-06-24  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  2:03 [PATCH V1 RESEND] drm/amdgpu: deduplicate JPEG v5.0 interrupt routine Andre Luiz Batista Bueno
2026-05-11 14:55 ` Alex Deucher
2026-06-11  2:40   ` [PATCH v2] " Andre Luiz Batista Bueno
2026-06-11 10:59     ` sashiko-bot
2026-06-24  3:30   ` [PATCH V2 RESEND] " Andre Luiz Batista Bueno
2026-06-24  7:56     ` sashiko-bot [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=20260624075659.E17921F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=andrebueno.mac@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.