From: "Tobias Schumacher" <ts@linux.ibm.com>
To: <sashiko-reviews@lists.linux.dev>,
"Tobias Schumacher" <ts@linux.ibm.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>, <linux-s390@vger.kernel.org>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH 1/7] s390/pci: fix double-free in zpci MSI cleanup
Date: Thu, 20 Aug 2026 09:20:43 +0200 [thread overview]
Message-ID: <DKTL871ACAUC.E4I644TH501X@linux.ibm.com> (raw)
In-Reply-To: <20260819090308.A0A2C1F00A3A@smtp.kernel.org>
On Wed Aug 19, 2026 at 11:03 AM CEST, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>
> Pre-existing issues:
> - [Medium] Pre-existing memory leak of `struct resource_entry` in `zbus->resources` when PCI root bus creation fails.
> --
-- snip --
> [Severity: Medium]
> This is a pre-existing issue, but while reviewing the error path discussed in
> the commit message (when pci_create_root_bus() fails), does zpci_bus_release()
> leak zbus->resources?
>
> In arch/s390/pci/pci_bus.c:zpci_bus_alloc(), a resource is added to the list:
>
> INIT_LIST_HEAD(&zbus->resources);
> zbus->bus_resource.start = 0;
> zbus->bus_resource.end = ZPCI_BUS_NR;
> zbus->bus_resource.flags = IORESOURCE_BUS;
> pci_add_resource(&zbus->resources, &zbus->bus_resource);
>
> But in the error path where pci_create_root_bus() fails, zbus->bus is not set.
> Later in zpci_bus_release(), pci_free_resource_list() is only called if
> zbus->bus is true:
>
> if (zbus->bus) {
> pci_lock_rescan_remove();
> pci_stop_root_bus(zbus->bus);
>
> zpci_free_domain(zbus->domain_nr);
> pci_free_resource_list(&zbus->resources);
>
> pci_remove_root_bus(zbus->bus);
> pci_unlock_rescan_remove();
> }
>
> Can this leak the struct resource_entry on this initialization error path?
Yes, seems like pci_free_resource_list() should be moved outside the if
block. But this should be fixed in a separate patch outside this series
since it is unrelated to the introduction of the irq domains.
Tobias
next prev parent reply other threads:[~2026-08-20 7:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 8:50 [PATCH 0/7] s390/pci: Fix multiple bugs in IRQ domain migration Tobias Schumacher
2026-08-19 8:50 ` [PATCH 1/7] s390/pci: fix double-free in zpci MSI cleanup Tobias Schumacher
2026-08-19 9:03 ` sashiko-bot
2026-08-20 7:20 ` Tobias Schumacher [this message]
2026-08-19 8:50 ` [PATCH 2/7] s390/pci: fix use-after-free race in zpci floating interrupt cleanup Tobias Schumacher
2026-08-19 9:20 ` sashiko-bot
2026-08-20 7:29 ` Tobias Schumacher
2026-08-19 8:50 ` [PATCH 3/7] s390/pci: fix resource leak in zpci MSI setup Tobias Schumacher
2026-08-19 9:05 ` sashiko-bot
2026-08-20 7:43 ` Tobias Schumacher
2026-08-19 8:50 ` [PATCH 4/7] s390/pci: fix MSI directed-mode teardown IRQ bit count Tobias Schumacher
2026-08-19 9:07 ` sashiko-bot
2026-08-20 8:30 ` Tobias Schumacher
2026-08-19 8:50 ` [PATCH 5/7] s390/pci: add NULL check in zpci_msi_clear_airq() Tobias Schumacher
2026-08-19 9:14 ` sashiko-bot
2026-08-20 8:41 ` Tobias Schumacher
2026-08-19 8:50 ` [PATCH 6/7] s390/pci: add error cleanup in zpci_directed_irq_init Tobias Schumacher
2026-08-19 9:02 ` sashiko-bot
2026-08-20 9:01 ` Tobias Schumacher
2026-08-19 8:51 ` [PATCH 7/7] s390/pci: move MSI affinity flag initialization to boot time Tobias Schumacher
2026-08-19 9:06 ` sashiko-bot
2026-08-19 9:24 ` [PATCH 0/7] s390/pci: Fix multiple bugs in IRQ domain migration 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=DKTL871ACAUC.E4I644TH501X@linux.ibm.com \
--to=ts@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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