From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com
Cc: 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: Mon, 22 Apr 2024 10:25:13 +0200 [thread overview]
Message-ID: <5efcafac-2f2c-4a2e-b964-7f412c30df4a@linux.ibm.com> (raw)
In-Reply-To: <20240419160723.320910-2-jean-philippe@linaro.org>
Am 19.04.24 um 18:07 schrieb Jean-Philippe Brucker:
> 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: Christian Borntraeger <borntraeger@linux.ibm.com>
thanks applied.
> ---
> 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:
prev parent reply other threads:[~2024-04-22 8:25 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
2024-04-22 8:25 ` Christian Borntraeger [this message]
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=5efcafac-2f2c-4a2e-b964-7f412c30df4a@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).