Commit 9b8e8aad authored by Claudio Imbrenda's avatar Claudio Imbrenda
Browse files

KVM: s390: ucontrol: Fix memslot handling



Fix memslots handling for UCONTROL guests. Attempts to delete user
memslots will fail, as they should, without the risk of a NULL pointer
dereference.

Fixes: 413c98f2 ("KVM: s390: fake memslot for ucontrol VMs")
Reviewed-by: default avatarSteffen Eiden <seiden@linux.ibm.com>
Signed-off-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
parent 857e9266
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5642,7 +5642,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
				   struct kvm_memory_slot *new,
				   enum kvm_mr_change change)
{
	if (kvm_is_ucontrol(kvm) && new->id < KVM_USER_MEM_SLOTS)
	if (kvm_is_ucontrol(kvm) && new && new->id < KVM_USER_MEM_SLOTS)
		return -EINVAL;

	/* When we are protected, we should not change the memory slots */