File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1971,7 +1971,15 @@ static int kvm_set_memory_region(struct kvm *kvm,
1971
1971
return - EINVAL ;
1972
1972
if (mem -> guest_phys_addr + mem -> memory_size < mem -> guest_phys_addr )
1973
1973
return - EINVAL ;
1974
- if ((mem -> memory_size >> PAGE_SHIFT ) > KVM_MEM_MAX_NR_PAGES )
1974
+
1975
+ /*
1976
+ * The size of userspace-defined memory regions is restricted in order
1977
+ * to play nice with dirty bitmap operations, which are indexed with an
1978
+ * "unsigned int". KVM's internal memory regions don't support dirty
1979
+ * logging, and so are exempt.
1980
+ */
1981
+ if (id < KVM_USER_MEM_SLOTS &&
1982
+ (mem -> memory_size >> PAGE_SHIFT ) > KVM_MEM_MAX_NR_PAGES )
1975
1983
return - EINVAL ;
1976
1984
1977
1985
slots = __kvm_memslots (kvm , as_id );
You can’t perform that action at this time.
0 commit comments