From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Tobias Schumacher <ts@linux.ibm.com>,
Gerd Bayer <gbayer@linux.ibm.com>,
Julian Ruess <julianr@linux.ibm.com>,
Farhan Ali <alifm@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] s390/pci: Fix double-free and NULL deref in zpci MSI domain cleanup
Date: Tue, 06 Oct 2026 11:42:53 +0200 [thread overview]
Message-ID: <bc8b6453b1f4ce65a16108f6f940e286c139ad0c.camel@linux.ibm.com> (raw)
In-Reply-To: <20261005-s390_irq_domain_fixes-v2-1-d45b824874c0@linux.ibm.com>
On Mon, 2026-10-05 at 14:03 +0200, Tobias Schumacher wrote:
> zpci_remove_parent_msi_domain() dereferences zbus->msi_parent_domain
> unconditionally and does not clear it afterwards.
>
> zpci_bus_create_pci_bus() removes the domain when pci_create_root_bus()
> fails, then zpci_bus_release() removes it again on the last kref_put(),
> reading ->fwnode from the freed irq_domain and freeing it twice.
>
> If zpci_alloc_domain() or zpci_create_parent_msi_domain() fails, no domain
> is created at all; zbus is kzalloc'd, so the same release path dereferences
> NULL.
>
> Return early when there is no domain, and clear the pointer after removing
> one.
>
> Fixes: f770950a4709 ("s390/pci: Migrate s390 IRQ logic to IRQ domain API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tobias Schumacher <ts@linux.ibm.com>
> ---
> arch/s390/pci/pci_irq.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c
> index 9c9ed3d8d959..c9520a16ca75 100644
> --- a/arch/s390/pci/pci_irq.c
> +++ b/arch/s390/pci/pci_irq.c
> @@ -533,9 +533,13 @@ void zpci_remove_parent_msi_domain(struct zpci_bus *zbus)
> {
> struct fwnode_handle *fn;
>
> + if (!zbus->msi_parent_domain)
> + return;
> +
> fn = zbus->msi_parent_domain->fwnode;
> irq_domain_remove(zbus->msi_parent_domain);
> irq_domain_free_fwnode(fn);
> + zbus->msi_parent_domain = NULL;
> }
>
> static void __init cpu_enable_directed_irq(void *unused)
Thanks for the fix!
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
next prev parent reply other threads:[~2026-10-06 9:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 12:03 [PATCH v2 0/7] s390/pci: Fix bugs in IRQ domain migration and resource cleanup Tobias Schumacher
2026-10-05 12:03 ` [PATCH v2 1/7] s390/pci: Fix double-free and NULL deref in zpci MSI domain cleanup Tobias Schumacher
2026-10-06 9:42 ` Niklas Schnelle [this message]
2026-10-05 12:03 ` [PATCH v2 2/7] s390/pci: Fix resource leak in zpci MSI setup Tobias Schumacher
2026-10-06 9:55 ` Niklas Schnelle
2026-10-05 12:03 ` [PATCH v2 3/7] s390/pci: Fix MSI directed-mode teardown IRQ bit count Tobias Schumacher
2026-10-06 11:10 ` Niklas Schnelle
2026-10-05 12:03 ` [PATCH v2 4/7] s390/pci: Fix use-after-free race in zpci floating interrupt cleanup Tobias Schumacher
2026-10-06 15:18 ` Niklas Schnelle
2026-10-05 12:03 ` [PATCH v2 5/7] s390/pci: Add error cleanup in zpci_directed_irq_init Tobias Schumacher
2026-10-06 13:32 ` Niklas Schnelle
2026-10-05 12:03 ` [PATCH v2 6/7] s390/pci: Set MSI_FLAG_NO_AFFINITY at IRQ init time Tobias Schumacher
2026-10-06 15:33 ` Niklas Schnelle
2026-10-05 12:03 ` [PATCH v2 7/7] s390/pci: Drop the unused index argument of zpci_msi_clear_airq() Tobias Schumacher
2026-10-06 15:28 ` Niklas Schnelle
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=bc8b6453b1f4ce65a16108f6f940e286c139ad0c.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=alifm@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gbayer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=julianr@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=ts@linux.ibm.com \
/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®