From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: borntraeger@linux.ibm.com, frankja@linux.ibm.com,
david@redhat.com, hca@linux.ibm.com, gor@linux.ibm.com,
agordeev@linux.ibm.com, svens@linux.ibm.com, kvm@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH] KVM: s390: Check kvm pointer when testing KVM_CAP_S390_HPAGE_1M
Date: Fri, 19 Apr 2024 18:43:38 +0200 [thread overview]
Message-ID: <20240419184338.51efead9@p-imbrenda> (raw)
In-Reply-To: <20240419160723.320910-2-jean-philippe@linaro.org>
On Fri, 19 Apr 2024 17:07:24 +0100
Jean-Philippe Brucker <jean-philippe@linaro.org> wrote:
> 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>
> ---
> Only build-tested
> ---
> arch/s390/kvm/kvm-s390.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 5147b943a864a..7721eb522f43d 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:
next prev parent reply other threads:[~2024-04-19 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 16:07 [PATCH] KVM: s390: Check kvm pointer when testing KVM_CAP_S390_HPAGE_1M Jean-Philippe Brucker
2024-04-19 16:43 ` Claudio Imbrenda [this message]
2024-04-22 8:25 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240419184338.51efead9@p-imbrenda \
--to=imbrenda@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jean-philippe@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox