public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Guangshuo Li <lgs201920130244@gmail.com>,
	Min Ma <mamin506@gmail.com>, Oded Gabbay <ogabbay@kernel.org>,
	Jeff Hugo <jeff.hugo@oss.qualcomm.com>,
	George Yang <George.Yang@amd.com>,
	Narendra Gutta <VenkataNarendraKumar.Gutta@amd.com>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Cc: <stable@vger.kernel.org>
Subject: Re: [PATCH] accel/amdxdna: fix IRQ vector leak in aie2_init()
Date: Tue, 14 Apr 2026 09:06:26 -0700	[thread overview]
Message-ID: <4b7a0492-6ebb-e0a9-ca48-f2da6002d3e9@amd.com> (raw)
In-Reply-To: <20260414121024.3142118-1-lgs201920130244@gmail.com>


On 4/14/26 05:10, Guangshuo Li wrote:
> [You don't often get email from lgs201920130244@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> aie2_init() allocates MSI-X vectors with pci_alloc_irq_vectors() before
> creating the PSP handle, starting the hardware and initializing the
> resolver.
>
> When aie2m_psp_create(), aie2_hw_start() or xrsm_init() fails after IRQ
> vectors have been allocated successfully, the function releases the
> firmware and unwinds hardware state, but fails to free the allocated
> IRQ vectors.

aie2_init enables device via pcim_enable_device(), which sets managed 
device. Thus the vectors are automatically cleanup. So NAK.


Lizhi

>
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review. Add a dedicated error path to free the IRQ
> vectors after pci_alloc_irq_vectors() succeeds.
>
> Fixes: 8c9ff1b181ba ("accel/amdxdna: Add a new driver for AMD AI Engine")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>   drivers/accel/amdxdna/aie2_pci.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
> index 4924a9da55b6..f05f49f691b5 100644
> --- a/drivers/accel/amdxdna/aie2_pci.c
> +++ b/drivers/accel/amdxdna/aie2_pci.c
> @@ -591,14 +591,14 @@ static int aie2_init(struct amdxdna_dev *xdna)
>          if (!ndev->psp_hdl) {
>                  XDNA_ERR(xdna, "failed to create psp");
>                  ret = -ENOMEM;
> -               goto release_fw;
> +               goto free_irq_vectors;
>          }
>          xdna->dev_handle = ndev;
>
>          ret = aie2_hw_start(xdna);
>          if (ret) {
>                  XDNA_ERR(xdna, "start npu failed, ret %d", ret);
> -               goto release_fw;
> +               goto free_irq_vectors;
>          }
>
>          xrs_cfg.clk_list.num_levels = ndev->max_dpm_level + 1;
> @@ -623,6 +623,8 @@ static int aie2_init(struct amdxdna_dev *xdna)
>
>   stop_hw:
>          aie2_hw_stop(xdna);
> +free_irq_vectors:
> +       pci_free_irq_vectors(pdev);
>   release_fw:
>          release_firmware(fw);
>
> --
> 2.43.0
>

  reply	other threads:[~2026-04-14 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14 12:10 [PATCH] accel/amdxdna: fix IRQ vector leak in aie2_init() Guangshuo Li
2026-04-14 16:06 ` Lizhi Hou [this message]
2026-04-15  2:05   ` Guangshuo Li

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=4b7a0492-6ebb-e0a9-ca48-f2da6002d3e9@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=George.Yang@amd.com \
    --cc=VenkataNarendraKumar.Gutta@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=lgs201920130244@gmail.com \
    --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