mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
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: 413c98f24c ("KVM: s390: fake memslot for ucontrol VMs")
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
This commit is contained in:
parent
857e92662c
commit
9b8e8aad58
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user