Linux-PCI Archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: David Matlack <dmatlack@google.com>
Cc: sashiko-reviews@lists.linux.dev, linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 02/11] PCI: liveupdate: Track outgoing preserved PCI devices
Date: Fri, 22 May 2026 12:57:55 -0500	[thread overview]
Message-ID: <20260522175755.GA231746@bhelgaas> (raw)
In-Reply-To: <agYRd0xQs0r8OOKA@google.com>

On Thu, May 14, 2026 at 06:16:23PM +0000, David Matlack wrote:
> On 2026-05-14 12:31 AM, sashiko-bot@kernel.org wrote:
> ...

> > >  static void pci_flb_unpreserve(struct liveupdate_flb_op_args *args)
> > >  {
> > > -	struct pci_ser *ser = args->obj;
> > > +	struct pci_flb_outgoing *outgoing = args->obj;
> > >  
> > > -	WARN_ON_ONCE(ser->nr_devices);
> > > -	kho_unpreserve_free(ser);
> > > +	WARN_ON_ONCE(outgoing->ser->nr_devices);
> > > +	kho_unpreserve_free(outgoing->ser);
> > > +	kfree(outgoing);
> > 
> > If a driver fails to unpreserve a device before the FLB is torn down, this
> > WARN_ON_ONCE triggers, but the memory is still freed.
> > 
> > Does this leave dev->liveupdate.outgoing pointing to freed memory?
> 
> Yes, if a driver unpreserves a device without notifying the PCI core
> then that would lead to the PCI core having a pointer to freed memory.

Just a curiosity, I guess: How is this possible?  Is the driver
responsible for doing a generic unpreserve and also a PCI unpreserve?
Seems like it should do a single unpreserve, which should internally
take care of whatever PCI/IOMMU/etc unpreserve is needed.

I guess the requirement is explained in "[02/11] PCI: liveupdate:
Track outgoing ...":

  + * ... Drivers must call
  + * pci_liveupdate_unpreserve() from their struct liveupdate_file_handler
  + * unpreserve() callback to ensure the outgoing struct pci_ser is allocated.

I just don't know what the driver changes will look like.

  reply	other threads:[~2026-05-22 17:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 18:48 [PATCH v5 00/11] PCI: liveupdate: PCI core support for Live Update David Matlack
2026-05-12 18:48 ` [PATCH v5 01/11] PCI: liveupdate: Set up FLB handler for the PCI core David Matlack
2026-05-12 18:48 ` [PATCH v5 02/11] PCI: liveupdate: Track outgoing preserved PCI devices David Matlack
2026-05-14  0:31   ` sashiko-bot
2026-05-14 18:16     ` David Matlack
2026-05-22 17:57       ` Bjorn Helgaas [this message]
2026-05-22 18:07         ` David Matlack
2026-05-12 18:48 ` [PATCH v5 03/11] PCI: liveupdate: Track incoming " David Matlack
2026-05-14  1:05   ` sashiko-bot
2026-05-14 18:27     ` David Matlack
2026-05-12 18:48 ` [PATCH v5 04/11] PCI: liveupdate: Document driver binding responsibilities David Matlack
2026-05-12 18:48 ` [PATCH v5 05/11] PCI: liveupdate: Keep bus numbers constant during Live Update David Matlack
2026-05-14  1:36   ` sashiko-bot
2026-05-14 18:39     ` David Matlack
2026-05-22 17:59   ` Bjorn Helgaas
2026-05-12 18:48 ` [PATCH v5 06/11] PCI: liveupdate: Auto-preserve upstream bridges across " David Matlack
2026-05-14  2:05   ` sashiko-bot
2026-05-14 18:41     ` David Matlack
2026-05-12 18:48 ` [PATCH v5 07/11] PCI: liveupdate: Inherit ACS flags in incoming preserved devices David Matlack
2026-05-14  2:37   ` sashiko-bot
2026-05-14 18:46     ` David Matlack
2026-05-12 18:48 ` [PATCH v5 08/11] PCI: liveupdate: Inherit ARI Forwarding Enable on preserved bridges David Matlack
2026-05-12 18:48 ` [PATCH v5 09/11] PCI: liveupdate: Freeze preservation status during shutdown David Matlack
2026-05-14  3:14   ` sashiko-bot
2026-05-14 18:48     ` David Matlack
2026-05-12 18:48 ` [PATCH v5 10/11] PCI: liveupdate: Do not disable bus mastering on preserved devices during kexec David Matlack
2026-05-22 18:01   ` Bjorn Helgaas
2026-05-12 18:48 ` [PATCH v5 11/11] Documentation: PCI: Add documentation for Live Update David Matlack

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=20260522175755.GA231746@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=dmatlack@google.com \
    --cc=linux-pci@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).