Re: [PATCH v3 1/4] s390/pci: Fix leak of struct pci_dev reference in zpci_report_status()
From: Benjamin Block
Date: Wed Sep 23 2026 - 05:30:16 EST
On Mon, Sep 21, 2026 at 01:54:03PM +0200, Niklas Schnelle wrote:
> On Fri, 2026-09-18 at 10:37 +0200, Benjamin Block wrote:
> > On Wed, Sep 16, 2026 at 05:14:10PM +0200, Niklas Schnelle wrote:
> > > diff --git a/arch/s390/pci/pci_report.c b/arch/s390/pci/pci_report.c
> > > index 7030f7052926..867419779219 100644
> > > --- a/arch/s390/pci/pci_report.c
> > > +++ b/arch/s390/pci/pci_report.c
> > > @@ -89,7 +89,8 @@ static struct debug_view debug_log_view = {
> > >
> > > /**
> > > * zpci_report_status - Report the status of operations on a PCI device
> > > - * @zdev: The PCI device for which to report status
> > > + * @zdev: The zPCI device for which to report status
> > > + * @pdev: The PCI device associated with the zdev if any, NULL otherwise
> > > * @operation: A string representing the operation reported
> > > * @status: A string representing the status of the operation
> > > *
> > > @@ -103,15 +104,15 @@ static struct debug_view debug_log_view = {
> > > *
> > > * Return: 0 on success an error code < 0 otherwise.
> > > */
> > > -int zpci_report_status(struct zpci_dev *zdev, const char *operation, const char *status)
> > > +int zpci_report_status(struct zpci_dev *zdev, struct pci_dev *pdev,
> > > + const char *operation, const char *status)
> >
> > One small thing that is in no way critical: I wonder whether we could make the
> > `pdev` const. We don't do anything with it apart from reading some attributes
> > and such.
>
> Just checked. This conflicts with device_lock_assert() taking a non-
> const struct device *. So we would have to adjust that as well.
Ok, fair enough.
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt / Geschäftsführung: David Faller
Sitz der Ges.: Ehningen / Registergericht: AmtsG Stuttgart, HRB 243294