From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Jim Mattson <jmattson@google.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Junaid Shahid" <junaids@google.com>,
kvm@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Wanpeng Li" <wanpengli@tencent.com>
Subject: Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
Date: Wed, 06 Nov 2019 08:30:04 +0000 [thread overview]
Message-ID: <8f7e33e9-9ae0-4f56-3bb6-b9f3db807d38@de.ibm.com> (raw)
In-Reply-To: <20191106082636.GB31923@mwanda>
The same patch was already sent by Wanpeng Li.
See
https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
On 06.11.19 09:26, Dan Carpenter wrote:
> If init_srcu_struct() or init_srcu_struct() fails then this function
> returns ERR_PTR(0) which is NULL. It leads to a NULL dereference in the
> caller.
>
> Fixes: 9121923c457d ("kvm: Allocate memslots and buses before calling kvm_arch_init_vm")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> virt/kvm/kvm_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index d16d2054e937..91971811fa5f 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -675,6 +675,7 @@ static struct kvm *kvm_create_vm(unsigned long type)
> INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list);
> #endif
>
> + r = -ENOMEM;
> if (init_srcu_struct(&kvm->srcu))
> goto out_err_no_srcu;
> if (init_srcu_struct(&kvm->irq_srcu))
>
WARNING: multiple messages have this Message-ID (diff)
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Jim Mattson <jmattson@google.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Junaid Shahid" <junaids@google.com>,
kvm@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Wanpeng Li" <wanpengli@tencent.com>
Subject: Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
Date: Wed, 6 Nov 2019 09:30:04 +0100 [thread overview]
Message-ID: <8f7e33e9-9ae0-4f56-3bb6-b9f3db807d38@de.ibm.com> (raw)
In-Reply-To: <20191106082636.GB31923@mwanda>
The same patch was already sent by Wanpeng Li.
See
https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
On 06.11.19 09:26, Dan Carpenter wrote:
> If init_srcu_struct() or init_srcu_struct() fails then this function
> returns ERR_PTR(0) which is NULL. It leads to a NULL dereference in the
> caller.
>
> Fixes: 9121923c457d ("kvm: Allocate memslots and buses before calling kvm_arch_init_vm")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> virt/kvm/kvm_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index d16d2054e937..91971811fa5f 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -675,6 +675,7 @@ static struct kvm *kvm_create_vm(unsigned long type)
> INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list);
> #endif
>
> + r = -ENOMEM;
> if (init_srcu_struct(&kvm->srcu))
> goto out_err_no_srcu;
> if (init_srcu_struct(&kvm->irq_srcu))
>
next prev parent reply other threads:[~2019-11-06 8:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-06 8:26 [PATCH] kvm: Fix NULL dereference doing kvm_create_vm() Dan Carpenter
2019-11-06 8:26 ` Dan Carpenter
2019-11-06 8:30 ` Christian Borntraeger [this message]
2019-11-06 8:30 ` Christian Borntraeger
2019-11-06 9:44 ` Paolo Bonzini
2019-11-06 9:44 ` Paolo Bonzini
2019-11-09 4:19 ` Wanpeng Li
2019-11-09 4:19 ` Wanpeng Li
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=8f7e33e9-9ae0-4f56-3bb6-b9f3db807d38@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=dan.carpenter@oracle.com \
--cc=jmattson@google.com \
--cc=junaids@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.