diff options
author | Sean Christopherson <seanjc@google.com> | 2025-03-15 06:10:48 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-27 13:11:32 +0300 |
commit | 91ef6a152768bb9a145c6e1f6b7b0482848ca530 (patch) | |
tree | 2e55776a88fca9eb491893c8bf1a1fef4923c0b0 | |
parent | 57a85eb1256568fe33af0e40d781cee8cf583f4a (diff) | |
download | linux-91ef6a152768bb9a145c6e1f6b7b0482848ca530.tar.xz |
iommu/amd: Ensure GA log notifier callbacks finish running before module unload
[ Upstream commit 94c721ea03c7078163f41dbaa101ac721ddac329 ]
Synchronize RCU when unregistering KVM's GA log notifier to ensure all
in-flight interrupt handlers complete before KVM-the module is unloaded.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20250315031048.2374109-1-seanjc@google.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/iommu/amd/iommu.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 4428a9557f29..23e78a034da8 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -861,6 +861,14 @@ int amd_iommu_register_ga_log_notifier(int (*notifier)(u32)) { iommu_ga_log_notifier = notifier; + /* + * Ensure all in-flight IRQ handlers run to completion before returning + * to the caller, e.g. to ensure module code isn't unloaded while it's + * being executed in the IRQ handler. + */ + if (!notifier) + synchronize_rcu(); + return 0; } EXPORT_SYMBOL(amd_iommu_register_ga_log_notifier); |