Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f8ca74 authored by Avi Kivity's avatar Avi Kivity
Browse files

KVM: Prevent overflow in largepages calculation



If userspace specifies a memory slot that is larger than 8 petabytes, it
could overflow the largepages variable.

Cc: stable@kernel.org
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent ac04527f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1087,8 +1087,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
	int r;
	gfn_t base_gfn;
	unsigned long npages, ugfn;
	int largepages;
	unsigned long i;
	unsigned long largepages, i;
	struct kvm_memory_slot *memslot;
	struct kvm_memory_slot old, new;