]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/pci: Use RCU for error/request triggers to avoid circular locking
authorAlex Williamson <alex.williamson@nvidia.com>
Mon, 24 Nov 2025 22:36:22 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:27 +0000 (14:03 +0100)
commitaddbb8ddb443f68ccb97e5889c7931033de909c6
treee4cc24c1241e97a25e41f1fed9daf829abd445cb
parent3e2fc1e57a5361633a4bf4222640c6bfe41ff8ea
vfio/pci: Use RCU for error/request triggers to avoid circular locking

[ Upstream commit 98693e0897f754e3f51ce6626ed5f785f625ba2b ]

Thanks to a device generating an ACS violation during bus reset,
lockdep reported the following circular locking issue:

CPU0: SET_IRQS (MSI/X): holds igate, acquires memory_lock
CPU1: HOT_RESET: holds memory_lock, acquires pci_bus_sem
CPU2: AER: holds pci_bus_sem, acquires igate

This results in a potential 3-way deadlock.

Remove the pci_bus_sem->igate leg of the triangle by using RCU
to peek at the eventfd rather than locking it with igate.

Fixes: 3be3a074cf5b ("vfio-pci: Don't use device_lock around AER interrupt setup")
Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20251124223623.2770706-1-alex@shazbot.org
Signed-off-by: Alex Williamson <alex@shazbot.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/pci/vfio_pci_intrs.c
drivers/vfio/pci/vfio_pci_priv.h
include/linux/vfio_pci_core.h