linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Nirmal Patel" <nirmal.patel@linux.intel.com>,
	"Jonathan Derrick" <jonathan.derrick@linux.dev>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Kenneth Crudup" <kenny@panix.com>,
	"Ammar Faizi" <ammarfaizi2@gnuweeb.org>
Subject: Re: [PATCH v2] PCI: vmd: Fix wrong kfree() in vmd_msi_free()
Date: Thu, 07 Aug 2025 19:43:17 +0200	[thread overview]
Message-ID: <87bjorxc22.fsf@yellow.woof> (raw)
In-Reply-To: <20250807163309.GA52078@bhelgaas>

Bjorn Helgaas <helgaas@kernel.org> writes:
> On Thu, Aug 07, 2025 at 10:10:51AM +0200, Nam Cao wrote:
>> vmd_msi_alloc() allocates struct vmd_irq and stashes it into
>> irq_data->chip_data associated with the VMD's interrupt domain.
>> vmd_msi_free() extracts the pointer by calling irq_get_chip_data() and
>> frees it.
>> 
>> irq_get_chip_data() returns the chip_data associated with the top interrupt
>> domain. This worked in the past, because VMD's interrupt domain was the top
>> domain.
>> 
>> But since commit d7d8ab87e3e7 ("PCI: vmd: Switch to
>> msi_create_parent_irq_domain()") changed the interrupt domain hierarchy,
>> VMD's interrupt domain is not the top domain anymore. irq_get_chip_data()
>> now returns the chip_data at the MSI devices' interrupt domains. It is
>> therefore broken for vmd_msi_free() to kfree() this chip_data.
>> 
>> Fix this issue, correctly extract the chip_data associated with the VMD's
>> interrupt domain.
...
>
> Applied to pci/for-linus for v6.17, thanks!
>
> I assume you checked the other msi_create_parent_irq_domain() changes
> for similar problems?

Not before you reminded me :(

But yes, none of the similar PCI patches has the same problem.

Nam

  reply	other threads:[~2025-08-07 17:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07  8:10 [PATCH v2] PCI: vmd: Fix wrong kfree() in vmd_msi_free() Nam Cao
2025-08-07  8:39 ` Manivannan Sadhasivam
2025-08-07 13:51 ` Thomas Gleixner
2025-08-07 16:33 ` Bjorn Helgaas
2025-08-07 17:43   ` Nam Cao [this message]
2025-08-07 18:11     ` Bjorn Helgaas

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=87bjorxc22.fsf@yellow.woof \
    --to=namcao@linutronix.de \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=jonathan.derrick@linux.dev \
    --cc=kenny@panix.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=nirmal.patel@linux.intel.com \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).