diff options
author | Jean-Philippe Brucker <jean-philippe@linaro.org> | 2024-04-19 18:07:24 +0200 |
---|---|---|
committer | Christian Borntraeger <borntraeger@linux.ibm.com> | 2024-05-02 09:41:38 +0200 |
commit | 175f2f5bcdfce9e728f1ff956a50f28824d28791 (patch) | |
tree | 99bae9412e3849f89cab362fe0cbd5618dafeebd | |
parent | Merge tag 'kvmarm-fixes-6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff) | |
download | linux-175f2f5bcdfce9e728f1ff956a50f28824d28791.tar.xz linux-175f2f5bcdfce9e728f1ff956a50f28824d28791.zip |
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: 40ebdb8e59df ("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>
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 5147b943a864..7721eb522f43 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -587,7 +587,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) break; case KVM_CAP_S390_HPAGE_1M: r = 0; - if (hpage && !kvm_is_ucontrol(kvm)) + if (hpage && !(kvm && kvm_is_ucontrol(kvm))) r = 1; break; case KVM_CAP_S390_MEM_OP: |