vfio/pci: Drain eventfd RCU callbacks on module exit

vfio_pci_eventfd_replace_locked() defers freeing replaced eventfds to
vfio_pci_eventfd_rcu_free(). A callback can remain queued after
close_device() returns and the device driver module reference is dropped.
Once the dependent driver is removed, vfio-pci-core can be unloaded while
the callback still points into its module text.

Wait for outstanding RCU callbacks before vfio-pci-core exits.

Fixes: 98693e0897 ("vfio/pci: Use RCU for error/request triggers to avoid circular locking")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Link: https://lore.kernel.org/r/20261003093806.544631-1-yaojiale02@163.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
This commit is contained in:
Jiale Yao 2026-10-03 17:38:06 +08:00 committed by Alex Williamson
parent b30b52c2fb
commit 3b2e9b0501

View File

@ -2675,6 +2675,7 @@ static void vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set)
static void vfio_pci_core_cleanup(void)
{
vfio_pci_uninit_perm_bits();
rcu_barrier();
}
static int __init vfio_pci_core_init(void)