mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: "Colin King (gmail)" <colin.i.king@gmail.com>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	linux-pci@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: PCI: vmd: repeated kfree of vmdirq
Date: Thu, 17 Jul 2025 13:52:20 +0200	[thread overview]
Message-ID: <20250717115220.jfvzVfuR@linutronix.de> (raw)
In-Reply-To: <013ea925-accc-4927-aca5-7fad4043377b@gmail.com>

On Thu, Jul 17, 2025 at 12:48:02PM +0100, Colin King (gmail) wrote:
> Hi,
> 
> Static analysis found an issue in the following commit in linux-next:
> 
> commit 2b96beffa42760513567919aa27eb72035f2db58
> Author: Nam Cao <namcao@linutronix.de>
> Date:   Thu Jun 26 16:48:06 2025 +0200
> 
>     PCI: vmd: Switch to msi_create_parent_irq_domain()
> 
> 
> The issue is as follows:
> 
> static void vmd_msi_free(struct irq_domain *domain, unsigned int virq,
> unsigned int nr_irqs)
> {
>         struct vmd_irq *vmdirq = irq_get_chip_data(virq);
> 
>         for (int i = 0; i < nr_irqs; ++i) {
>                 synchronize_srcu(&vmdirq->irq->srcu);
> 
>                 /* XXX: Potential optimization to rebalance */
>                 scoped_guard(raw_spinlock_irq, &list_lock)
>                         vmdirq->irq->count--;
> 
>                 kfree(vmdirq);
>         }
> }
> 
> The for-loop is repeatedly kfree'ing vmdirq which seems incorrect.

Thanks for the report. It has been resolved in PCI tree.

Best regards,
Nam

      reply	other threads:[~2025-07-17 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 11:48 Colin King (gmail)
2025-07-17 11:52 ` Nam Cao [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=20250717115220.jfvzVfuR@linutronix.de \
    --to=namcao@linutronix.de \
    --cc=bhelgaas@google.com \
    --cc=colin.i.king@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=tglx@linutronix.de \
    /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®