public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: avi@redhat.com, kvm <kvm@vger.kernel.org>, stable@kernel.org
Subject: Re: [patch 2/3] KVM: x86: disallow KVM_{SET,GET}_LAPIC without in kernel irqchip
Date: Tue, 27 Oct 2009 19:50:26 +0200	[thread overview]
Message-ID: <20091027175026.GC14421@redhat.com> (raw)
In-Reply-To: <20091027151125.345664553@redhat.com>

On Tue, Oct 27, 2009 at 01:10:44PM -0200, Marcelo Tosatti wrote:
> Otherwise kvm might attempt to dereference a NULL pointer.
> 
> CC: stable@kernel.org
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Index: kvm/arch/x86/kvm/x86.c
> ===================================================================
> --- kvm.orig/arch/x86/kvm/x86.c
> +++ kvm/arch/x86/kvm/x86.c
> @@ -1815,6 +1815,9 @@ long kvm_arch_vcpu_ioctl(struct file *fi
>  
>  	switch (ioctl) {
>  	case KVM_GET_LAPIC: {
> +		r = -EINVAL;
> +		if (!irqchip_in_kernel(vcpu->kvm))
> +			goto out;
>  		lapic = kzalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL);
>  
>  		r = -ENOMEM;
> @@ -1830,6 +1833,9 @@ long kvm_arch_vcpu_ioctl(struct file *fi
>  		break;
>  	}
>  	case KVM_SET_LAPIC: {
> +		r = -EINVAL;
> +		if (!irqchip_in_kernel(vcpu->kvm))
> +			goto out;
>  		lapic = kmalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL);
>  		r = -ENOMEM;
>  		if (!lapic)
> 

Can the value of irqchip_in_kernel be changed by userspace
after we have checked it? If yes, this check won't help ...


> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-10-27 17:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 15:10 [patch 0/3] ioctl fixes Marcelo Tosatti
2009-10-27 15:10 ` [patch 1/3] KVM: x86: disallow multiple KVM_CREATE_IRQCHIP Marcelo Tosatti
2009-10-27 17:49   ` Michael S. Tsirkin
2009-10-27 15:10 ` [patch 2/3] KVM: x86: disallow KVM_{SET,GET}_LAPIC without in kernel irqchip Marcelo Tosatti
2009-10-27 17:50   ` Michael S. Tsirkin [this message]
2009-10-28  9:32     ` Avi Kivity
2009-10-28 10:20       ` Michael S. Tsirkin
2009-10-28 10:30         ` Gleb Natapov
2009-10-28 10:32           ` Michael S. Tsirkin
2009-10-28 10:39             ` Gleb Natapov
2009-10-28 10:34         ` Avi Kivity
2009-10-27 15:10 ` [patch 3/3] KVM: only clear irq_source_id if irqchip is present Marcelo Tosatti
2009-10-28 20:42 ` [patch 0/3] ioctl fixes v2 Marcelo Tosatti
2009-10-28 20:42   ` [patch 1/3] KVM: x86: disallow multiple KVM_CREATE_IRQCHIP Marcelo Tosatti
2009-10-29  9:32     ` Michael S. Tsirkin
2009-10-29 14:10       ` Marcelo Tosatti
2009-10-28 20:42   ` [patch 2/3] KVM: x86: disallow KVM_{SET,GET}_LAPIC without allocated in-kernel lapic Marcelo Tosatti
2009-10-28 20:42   ` [patch 3/3] KVM: only clear irq_source_id if irqchip is present Marcelo Tosatti
2009-10-29 15:44   ` [patch 0/3] ioctl fixes v3 Marcelo Tosatti
2009-10-29 15:44     ` [patch 1/3] KVM: x86: disallow multiple KVM_CREATE_IRQCHIP Marcelo Tosatti
2009-10-29 15:44     ` [patch 2/3] KVM: x86: disallow KVM_{SET,GET}_LAPIC without allocated in-kernel lapic Marcelo Tosatti
2009-10-29 15:44     ` [patch 3/3] KVM: only clear irq_source_id if irqchip is present Marcelo Tosatti
2009-11-02  9:53     ` [patch 0/3] ioctl fixes v3 Avi Kivity

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=20091027175026.GC14421@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=stable@kernel.org \
    /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