From: sashiko-bot@kernel.org
To: "Omar Elghoul" <oelghoul@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
kvm@vger.kernel.org,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH v9 1/4] s390/pci: Hold fmb_lock when enabling or disabling PCI devices
Date: Wed, 07 Oct 2026 14:13:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-163092@kernel.org> (raw)
In-Reply-To: <20261007135926.82935-2-oelghoul@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] s390/pci: race in pcibios_disable_device leaves FMB enabled
--
commit 0f2a2ae0e5e387c72b216a0f886fdb95698ac275
Author: Omar Elghoul <oelghoul@linux.ibm.com>
s390/pci: Hold fmb_lock when enabling or disabling PCI devices
Ensure that fmb_lock is held by pcibios_enable_device() and
pcibios_disable_device() when calling zpci_fmb_enable_device() or
zpci_fmb_disable_device(), respectively.
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index d64c544b32b0c..c055a9ad09724 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
[ ... ]
> @@ -648,7 +654,9 @@ void pcibios_disable_device(struct pci_dev *pdev)
> {
> struct zpci_dev *zdev = to_zpci(pdev);
>
> + mutex_lock(&zdev->fmb_lock);
> zpci_fmb_disable_device(zdev);
> + mutex_unlock(&zdev->fmb_lock);
> zpci_debug_exit_device(zdev);
> }
[Severity: Medium]
Could this sequence allow a race condition with debugfs?
If a concurrent write to the debugfs statistics file occurs in the window
after mutex_unlock() but before zpci_debug_exit_device(), it appears it could
acquire fmb_lock and invoke zpci_fmb_enable_device().
If this happens, does it leave the FMB running in hardware without a debugfs
interface to control it, while also leaking the zdev->fmb memory?
Would it be safer to call zpci_debug_exit_device(zdev) before acquiring
fmb_lock?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007135926.82935-1-oelghoul@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-10-07 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 13:59 [PATCH v9 0/4] vfio-pci/zdev: Improved zPCI Function Measurement Support Omar Elghoul
2026-10-07 13:59 ` [PATCH v9 1/4] s390/pci: Hold fmb_lock when enabling or disabling PCI devices Omar Elghoul
2026-10-07 14:13 ` sashiko-bot [this message]
2026-10-07 13:59 ` [PATCH v9 2/4] s390/pci: Reuse FMB buffer and preserve state in device re-enablement Omar Elghoul
2026-10-07 14:11 ` sashiko-bot
2026-10-07 13:59 ` [PATCH v9 3/4] s390/pci: Fence FMB enable/disable via debugfs for passthrough devices Omar Elghoul
2026-10-07 14:06 ` sashiko-bot
2026-10-07 13:59 ` [PATCH v9 4/4] vfio-pci/zdev: Add VFIO FMB device features Omar Elghoul
2026-10-07 14:07 ` sashiko-bot
2026-10-07 14:24 ` Omar Elghoul
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=sashiko-outbox-163092@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=oelghoul@linux.ibm.com \
--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