Skip to content

Commit 175f2f5

Browse files
jpbruckerborntraeger
authored andcommitted
KVM: s390: Check kvm pointer when testing KVM_CAP_S390_HPAGE_1M
KVM allows issuing the KVM_CHECK_EXTENSION ioctl either on the /dev/kvm fd or the VM fd. In the first case, kvm_vm_ioctl_check_extension() is called with kvm==NULL. Ensure we don't dereference the pointer in that case. Fixes: 40ebdb8 ("KVM: s390: Make huge pages unavailable in ucontrol VMs") Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com> Message-ID: <20240419160723.320910-2-jean-philippe@linaro.org> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
1 parent 16c2020 commit 175f2f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
587587
break;
588588
case KVM_CAP_S390_HPAGE_1M:
589589
r = 0;
590-
if (hpage && !kvm_is_ucontrol(kvm))
590+
if (hpage && !(kvm && kvm_is_ucontrol(kvm)))
591591
r = 1;
592592
break;
593593
case KVM_CAP_S390_MEM_OP:

0 commit comments

Comments
 (0)