From: Claudio Imbrenda Date: Thu, 2 Apr 2026 15:01:35 +0000 (+0200) Subject: KVM: s390: ucontrol: Fix memslot handling X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b8e8aad5896d66005d29920cb1643076a20b172;p=thirdparty%2Fkernel%2Flinux.git 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: 413c98f24c63 ("KVM: s390: fake memslot for ucontrol VMs") Reviewed-by: Steffen Eiden Signed-off-by: Claudio Imbrenda --- diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 156878c95e067..63bc496d0c37e 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -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 */