From: sashiko-bot@kernel.org
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/3] PCI: Fix NULL dereference when shrinking window without optional size
Date: Mon, 09 Nov 2026 14:52:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-205135@kernel.org> (raw)
In-Reply-To: <20261109144553.2516-2-ilpo.jarvinen@linux.intel.com>
> adjust_bridge_window() assumes a bridge window it needs to shrink is on
> add_list. A window is only added to add_list when it has optional size
> or alignment. When resource distribution gives a window that is not on
> add_list less space than its required size, res_to_dev_res() returns NULL
> that is unconditionally dereferenced.
>
> Consider a hotplug Root Port with no spare pref space and a switch below
> it with two non-hotplug Downstream Ports. 02:00.0 has a 2M pref BAR below
> it and 02:01.0 a 1M one. Alignment leaves only 1M of pref space for
> 02:00.0, and hot-add (emulated using a remove+rescan cycle) crashes in
> the inlined adjust_bridge_window():
>
> BUG: kernel NULL pointer dereference, address: 0000000000000030
> RIP: 0010:pci_bus_distribute_available_resources+0x19b/0x4b0
> Call Trace:
> <TASK>
> pci_bus_distribute_available_resources+0x468/0x4b0
> pci_bus_distribute_available_resources+0x468/0x4b0
> pci_bridge_distribute_available_resources+0x7a/0x90
> pci_assign_unassigned_bridge_resources+0x43/0xe0
> pci_rescan_bus_bridge_resize+0x23/0x40
> bus_rescan_store+0x63/0x80
>
> The required size must not be shrunk, so return early when the window
> has no optional size.
>
> Fixes: dc4b4d04e1ca ("PCI: Prevent shrinking bridge window from its required size")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109144553.2516-1-ilpo.jarvinen@linux.intel.com?part=1
next prev parent reply other threads:[~2026-11-09 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 14:45 [PATCH 0/3] PCI: Fix hotplug memory distribute Ilpo Järvinen
2026-11-09 14:45 ` [PATCH 1/3] PCI: Fix NULL dereference when shrinking window without optional size Ilpo Järvinen
2026-11-09 14:52 ` sashiko-bot [this message]
2026-11-09 14:45 ` [PATCH 2/3] PCI: Fix start of available space for the next bridge during distribution Ilpo Järvinen
2026-11-09 14:51 ` sashiko-bot
2026-11-09 14:45 ` [PATCH 3/3] PCI: Honor window granularity during resource distribution Ilpo Järvinen
2026-11-09 14:58 ` sashiko-bot
2026-11-09 22:59 ` [PATCH 0/3] PCI: Fix hotplug memory distribute Bjorn Helgaas
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-205135@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ilpo.jarvinen@linux.intel.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