summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-06-07 19:10:29 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2024-06-21 00:28:44 +0300
commitd81473840ce12fe682c19af9b4b5b39a9fe5a4c9 (patch)
treea28f2825fd4db9e4f9a25df9654ee3e978f7c6ae /virt
parentf99b052256f16224687e5947772f0942bff73fc1 (diff)
downloadlinux-d81473840ce12fe682c19af9b4b5b39a9fe5a4c9.tar.xz
KVM: interrupt kvm_gmem_populate() on signals
kvm_gmem_populate() is a potentially lengthy operation that can involve multiple calls to the firmware. Interrupt it if a signal arrives. Fixes: 1f6c06b177513 ("KVM: guest_memfd: Add interface for populating gmem pages with user data") Cc: Isaku Yamahata <isaku.yamahata@intel.com> Cc: Michael Roth <michael.roth@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/guest_memfd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
index 9714add38852..3bfe1824ec2d 100644
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@ -629,6 +629,11 @@ long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long
gfn_t gfn = start_gfn + i;
kvm_pfn_t pfn;
+ if (signal_pending(current)) {
+ ret = -EINTR;
+ break;
+ }
+
ret = __kvm_gmem_get_pfn(file, slot, gfn, &pfn, &max_order, false);
if (ret)
break;