* [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
@ 2019-11-06 8:26 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-11-06 8:26 UTC (permalink / raw)
To: Paolo Bonzini, Jim Mattson
Cc: Radim Krčmář, Junaid Shahid, kvm, kernel-janitors
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))
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
@ 2019-11-06 8:26 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-11-06 8:26 UTC (permalink / raw)
To: Paolo Bonzini, Jim Mattson
Cc: Radim Krčmář, Junaid Shahid, kvm, kernel-janitors
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))
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
2019-11-06 8:26 ` Dan Carpenter
@ 2019-11-06 8:30 ` Christian Borntraeger
-1 siblings, 0 replies; 8+ messages in thread
From: Christian Borntraeger @ 2019-11-06 8:30 UTC (permalink / raw)
To: Dan Carpenter, Paolo Bonzini, Jim Mattson
Cc: Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
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))
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
@ 2019-11-06 8:30 ` Christian Borntraeger
0 siblings, 0 replies; 8+ messages in thread
From: Christian Borntraeger @ 2019-11-06 8:30 UTC (permalink / raw)
To: Dan Carpenter, Paolo Bonzini, Jim Mattson
Cc: Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
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))
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
2019-11-06 8:30 ` Christian Borntraeger
@ 2019-11-06 9:44 ` Paolo Bonzini
-1 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2019-11-06 9:44 UTC (permalink / raw)
To: Christian Borntraeger, Dan Carpenter, Jim Mattson
Cc: Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
On 06/11/19 09:30, Christian Borntraeger wrote:
> The same patch was already sent by Wanpeng Li.
>
> See
> https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
I'm also going to send a somewhat different version today (hopefully).
Stay tuned...
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
@ 2019-11-06 9:44 ` Paolo Bonzini
0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2019-11-06 9:44 UTC (permalink / raw)
To: Christian Borntraeger, Dan Carpenter, Jim Mattson
Cc: Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
On 06/11/19 09:30, Christian Borntraeger wrote:
> The same patch was already sent by Wanpeng Li.
>
> See
> https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
I'm also going to send a somewhat different version today (hopefully).
Stay tuned...
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
2019-11-06 9:44 ` Paolo Bonzini
@ 2019-11-09 4:19 ` Wanpeng Li
-1 siblings, 0 replies; 8+ messages in thread
From: Wanpeng Li @ 2019-11-09 4:19 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Christian Borntraeger, Dan Carpenter, Jim Mattson,
Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
On Wed, 6 Nov 2019 at 17:46, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 06/11/19 09:30, Christian Borntraeger wrote:
> > The same patch was already sent by Wanpeng Li.
> >
> > See
> > https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
>
> I'm also going to send a somewhat different version today (hopefully).
> Stay tuned...
You can move forward if patches there.
Wanpeng
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kvm: Fix NULL dereference doing kvm_create_vm()
@ 2019-11-09 4:19 ` Wanpeng Li
0 siblings, 0 replies; 8+ messages in thread
From: Wanpeng Li @ 2019-11-09 4:19 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Christian Borntraeger, Dan Carpenter, Jim Mattson,
Radim Krčmář,
Junaid Shahid, kvm, kernel-janitors, Wanpeng Li
On Wed, 6 Nov 2019 at 17:46, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 06/11/19 09:30, Christian Borntraeger wrote:
> > The same patch was already sent by Wanpeng Li.
> >
> > See
> > https://lore.kernel.org/lkml/1572848879-21011-1-git-send-email-wanpengli@tencent.com/
>
> I'm also going to send a somewhat different version today (hopefully).
> Stay tuned...
You can move forward if patches there.
Wanpeng
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-11-09 4:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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.