]> git.ipfire.org Git - thirdparty/pciutils.git/commit
lspci: Fix unsynchronized caches in lspci struct device and pci struct pci_dev
authorNikita Proshkin <n.proshkin@yadro.com>
Wed, 27 Dec 2023 09:44:50 +0000 (14:44 +0500)
committerMartin Mares <mj@ucw.cz>
Sat, 17 Feb 2024 22:44:25 +0000 (23:44 +0100)
commit0ce6ff4aafb36a7923511a8da6bbbebb642e3109
tree8841228bfb70ecc04528c97711b8472eed9b3849
parente5d1d2dbb64cafd33f9b012b7959b61319dcd250
lspci: Fix unsynchronized caches in lspci struct device and pci struct pci_dev

lspci initializes both caches for the device to the same memory block in
its scan_device function. Latter calls to config_fetch function will
realloc cache in struct device, but not in struct pci_dev leading to
the invalid pointer in the latter. pci_dev cache is used by pci_read_*
functions, what will lead to a possible use-after-free situations.

Example:

With patch:
ls-caps.c
lspci.c