git: f8713b7f8dda - stable/15 - LinuxKPI: pci: make sure a tailq and lock are initialized
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 27 Feb 2026 02:29:47 UTC
The branch stable/15 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=f8713b7f8dda735e65c3a14a4634f9cc0427ae66
commit f8713b7f8dda735e65c3a14a4634f9cc0427ae66
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-01-24 22:16:36 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-02-26 23:02:39 +0000
LinuxKPI: pci: make sure a tailq and lock are initialized
Move the initializations of the tailq and lock from
linux_pci_attach_device() into lkpifill_pci_dev() so that they are
initialized in all cases we create a device (see all the possible
callers of lkpifill_pci_dev()).
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D54861
(cherry picked from commit 1f19fc2632c98cfe653a082b5fcb02d16053ed06)
---
sys/compat/linuxkpi/common/src/linux_pci.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index c8d1989f669b..c4f0564c7e35 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -385,14 +385,16 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev)
pdev->dev.bsddev = dev;
pdev->dev.parent = &linux_root_device;
pdev->dev.release = lkpi_pci_dev_release;
- INIT_LIST_HEAD(&pdev->dev.irqents);
if (pci_msi_count(dev) > 0)
pdev->msi_desc = malloc(pci_msi_count(dev) *
sizeof(*pdev->msi_desc), M_DEVBUF, M_WAITOK | M_ZERO);
+ TAILQ_INIT(&pdev->mmio);
+ spin_lock_init(&pdev->pcie_cap_lock);
spin_lock_init(&pdev->dev.devres_lock);
INIT_LIST_HEAD(&pdev->dev.devres_head);
+ INIT_LIST_HEAD(&pdev->dev.irqents);
return (0);
}
@@ -613,9 +615,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv,
if (error)
goto out_dma_init;
- TAILQ_INIT(&pdev->mmio);
- spin_lock_init(&pdev->pcie_cap_lock);
-
spin_lock(&pci_lock);
list_add(&pdev->links, &pci_devices);
spin_unlock(&pci_lock);