From: Heiko Carstens <hca@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH 2/3] s390/pci: Rework__zpci_event_availability() to remove conditional locking
Date: Mon, 3 Aug 2026 13:29:57 +0200 [thread overview]
Message-ID: <20260803112957.14792B73-hca@linux.ibm.com> (raw)
In-Reply-To: <20260803101800.552771F00A3D@smtp.kernel.org>
On Mon, Aug 03, 2026 at 10:17:59AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The `zdev` reference obtained via `get_zdev_by_fid()` is leaked when handling the `0x0306` PCI event.
> > - if (existing_zdev)
> > - mutex_lock(&zdev->state_lock);
> > + if (ccdf->pec == 0x0306) {
> > + /* 0x308 or 0x302 for multiple devices */
> > + zpci_remove_reserved_devices();
> > + zpci_scan_devices();
> > + return;
>
> [Severity: High]
> Does this early return leak the zdev reference?
>
> If get_zdev_by_fid() finds an existing device, it increments its reference
> count. By returning directly here when the event code is 0x0306, it seems we
> skip calling zpci_zdev_put() at the end of the function. Could this prevent
> the device from being properly freed during hot-unplug over time?
This is correct, but trying to fix this I also looked a bit deeper
into the code and found a "pre-existing" issue. Oh, well..
next prev parent reply other threads:[~2026-08-03 11:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 10:07 [PATCH 0/3] s390/pci: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-03 10:07 ` [PATCH 1/3] s390/pci: Rework __zpci_event_error() to remove conditional locking Heiko Carstens
2026-08-03 10:12 ` sashiko-bot
2026-08-03 10:07 ` [PATCH 2/3] s390/pci: Rework__zpci_event_availability() " Heiko Carstens
2026-08-03 10:17 ` sashiko-bot
2026-08-03 11:29 ` Heiko Carstens [this message]
2026-08-03 10:07 ` [PATCH 3/3] s390/pci: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-03 10:13 ` sashiko-bot
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=20260803112957.14792B73-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=gor@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