Skip to content

Commit d814738

Browse files
committed
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: 1f6c06b ("KVM: guest_memfd: Add interface for populating gmem pages with user data") Cc: Isaku Yamahata <[email protected]> Cc: Michael Roth <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent f99b052 commit d814738

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

virt/kvm/guest_memfd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long
629629
gfn_t gfn = start_gfn + i;
630630
kvm_pfn_t pfn;
631631

632+
if (signal_pending(current)) {
633+
ret = -EINTR;
634+
break;
635+
}
636+
632637
ret = __kvm_gmem_get_pfn(file, slot, gfn, &pfn, &max_order, false);
633638
if (ret)
634639
break;

0 commit comments

Comments
 (0)