]> git.ipfire.org Git - thirdparty/kernel/linux.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)
committerAlex Williamson <alex@shazbot.org>
Fri, 28 Nov 2025 17:04:27 +0000 (10:04 -0700)
commit98693e0897f754e3f51ce6626ed5f785f625ba2b
tree634b57ae01e46282b1b2f869bdf1e418b5caaf79
parentfa804aa4ac1b091ef2ec2981f08a1c28aaeba8e7
vfio/pci: Use RCU for error/request triggers to avoid circular locking

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>
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