티스토리 수익 글 보기
- commit
-
6ee831c40108c3b447bc8edad4c4ebd45b746574[log]
- author
-
Steffen Persvold <spersvold@gmail.com>Thu Jul 09 14:24:46 2026 +0200
- committer
-
Miri Amarilio <mirilio@google.com>Tue Sep 15 16:11:16 2026 -0700
PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems
commit 008cb88edb41f3c7c8e0ed763ff9f26719830984 upstream.
On 32-bit systems the config space is too large to ioremap in one go, so
pci_ecam_create() maps each bus segment separately and relies on the
->add_bus callback (pci_ecam_add_bus) to populate the per-bus mapping in
cfg->winp[]. pci_ecam_map_bus() then uses that mapping as the base for
every config access.
The generic ECAM ops (pci_generic_ecam_ops) already provide the ->add_bus
and ->remove_bus callbacks, but the CAM (legacy) ops in pci-host-generic.c
do not. As a result, on a 32-bit host using "pci-host-cam-generic" the
per-bus mapping is never set up and the first config read dereferences a
NULL base, crashing during bus enumeration:
Unable to handle kernel NULL pointer dereference at virtual address 00000800
Oops [#1]
CPU: 0 PID: 1 Comm: swapper Not tainted 6.9.7+ #43
Hardware name: Digilent Nexys-Video-A7 RV32 (DT)
epc : pci_generic_config_read+0x40/0xb0
ra : pci_generic_config_read+0x2c/0xb0
[<c038db9c>] pci_generic_config_read+0x40/0xb0
[<c038da04>] pci_bus_read_config_dword+0x50/0xb0
[<c0391e94>] pci_bus_generic_read_dev_vendor_id+0x3c/0x1ec
[<c039245c>] pci_scan_single_device+0xa4/0x11c
[<c0392570>] pci_scan_slot+0x9c/0x23c
[<c039388c>] pci_scan_child_bus_extend+0x58/0x2f4
[<c0393db0>] pci_scan_root_bus_bridge+0x64/0xe8
[<c0393e54>] pci_host_probe+0x20/0xc8
[<c03bc6f4>] pci_host_common_probe+0x144/0x1e4
Fix this by giving the CAM ops the same ->add_bus/->remove_bus callbacks.
Since pci_ecam_add_bus() and pci_ecam_remove_bus() are static to ecam.c,
move the CAM ops definition there as pci_generic_cam_ops (mirroring
pci_generic_ecam_ops) and export it for pci-host-generic.c to reference.
BUG=b/559877410
TEST=presubmit
RELEASE_NOTE=Fixed CVE-2026-80917 in the Linux kernel.
cos-patch: security-moderate
Fixes: 8fe55ef23387 ("PCI: Dynamically map ECAM regions")
Change-Id: Ie0ab65a2f6ea24160f46bb6d4434b138ce77f928
Signed-off-by: Steffen Persvold <spersvold@gmail.com>
[mani: removed timestamp from log]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260709122446.3151899-1-spersvold@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kernel CVE Triage Automation <cloud-image-kernel-cve-triage-automation@prod.google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/197507
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Reviewed-by: Miri Amarilio <mirilio@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
- drivers/pci/controller/pci-host-generic.c[diff]
- drivers/pci/ecam.c[diff]
- include/linux/pci-ecam.h[diff]
3 files changed
tree: 2db54a0ac7ea2745019ac4af772f392048325c7d
- arch/
- block/
- certs/
- crypto/
- Documentation/
- drivers/
- fs/
- google/
- include/
- init/
- io_uring/
- ipc/
- kernel/
- lib/
- LICENSES/
- mm/
- net/
- rust/
- samples/
- scripts/
- security/
- sound/
- tools/
- usr/
- virt/
- .clang-format
- .cocciconfig
- .get_maintainer.ignore
- .gitattributes
- .gitignore
- .mailmap
- .rustfmt.toml
- COPYING
- CREDITS
- Kbuild
- Kconfig
- MAINTAINERS
- Makefile
- PRESUBMIT.cfg
- README