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


[-- Attachment #1.1.1: Type: text/plain, Size: 868 bytes --]

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.

Colin

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 11:48 Colin King (gmail) [this message]
2025-07-17 11:52 ` Nam Cao

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=013ea925-accc-4927-aca5-7fad4043377b@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=bhelgaas@google.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=namcao@linutronix.de \
    --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®