mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Lukas Wunner <lukas@wunner.de>,
	Priyank Rathod <rathodpriyank@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Ricky Wu <ricky_wu@realtek.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: pciehp: Fix NULL pointer dereference in pciehp_configure_device()
Date: Tue, 10 Nov 2026 16:43:52 +0100	[thread overview]
Message-ID: <81a1fed9c86e3954b1807f7425f98d210503a28f.camel@linux.ibm.com> (raw)
In-Reply-To: <avLsH4a-l_uxlWfU@wunner.de>

On Tue, 2026-11-10 at 11:04 +0100, Lukas Wunner wrote:
> On Mon, Nov 09, 2026 at 09:53:38PM +0000, Priyank Rathod wrote:
> > On Mon, Oct 12, 2026 at 10:16:29PM +0000, sashiko-bot@kernel.org wrote:
> > > While this allows devices without Function 0 to be successfully hot-added,
> > > will it lead to spurious teardowns upon system resume?
> > ...
> > > Could this spurious teardown issue be avoided by modifying
> > > pciehp_device_replaced() to handle missing Function 0 devices correctly?
> [...]
> > Regarding the bot's question above: pciehp assumes Function 0
> > (PCI_DEVFN(0, 0)) represents an occupied slot across all four of its
> > lookup sites -- the -EEXIST check at the top of
> > pciehp_configure_device(), pcie_init(), pciehp_device_replaced(), and
> > the DSN read at the end of pciehp_configure_device() (consistent with
> > PCIe r6.3 sec 7.9.3 requiring Multi-Function Devices implementing DSN to
> > expose it on Function 0).
> 
> I'm not even sure whether pciehp is actually used with jailhouse,
> s390 or loongarch.  pciehp assumes in multiple places that function 0
> is present, so guarding against a missing function 0 in a single place
> doesn't really make sense.
> 
> Note that there's a patch pending which moves the cached dsn from
> pciehp's struct controller to struct pci_dev, so the days are numbered
> for the lines you're changing:
> 
> https://lore.kernel.org/r/20260902133933.2992457-7-terry.bowman@amd.com/
> 
> Are you actually observing a crash in practice because of a missing NULL
> pointer check?
> 
> Thanks,
> 
> Lukas

FWIW we (s390) do not use pciehp we use our own s390_pci_hpc for
hotplug. I'd be interested if this comes out of a real issue or just an
LLM worry too though.

Thanks,
Niklas

      reply	other threads:[~2026-11-10 15:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 22:03 Priyank Rathod
     [not found] ` <sashiko-outbox-168676@kernel.org>
2026-11-09 21:53   ` Priyank Rathod
2026-11-10 10:04     ` Lukas Wunner
2026-11-10 15:43       ` Niklas Schnelle [this message]

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=81a1fed9c86e3954b1807f7425f98d210503a28f.camel@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rathodpriyank@google.com \
    --cc=ricky_wu@realtek.com \
    /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

all inboxes | Powered by JetHome®