public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Xiubo Li <lixiubo@cmss.chinamobile.com>
Cc: gleb@kernel.org, pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: fix possible coalesced_mmio_ring page leaks.
Date: Tue, 24 Feb 2015 13:44:00 -0300	[thread overview]
Message-ID: <20150224164359.GA31733@amt.cnet> (raw)
In-Reply-To: <1423717101-9199-1-git-send-email-lixiubo@cmss.chinamobile.com>

On Thu, Feb 12, 2015 at 12:58:21PM +0800, Xiubo Li wrote:
> It forgets to free coalesced_mmio_ring page after the anon_inode_getfd
> fails.
> 
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
>  virt/kvm/kvm_main.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 8579f18..85e8106 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2784,16 +2784,22 @@ static int kvm_dev_ioctl_create_vm(unsigned long type)
>  		return PTR_ERR(kvm);
>  #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
>  	r = kvm_coalesced_mmio_init(kvm);
> -	if (r < 0) {
> -		kvm_put_kvm(kvm);
> -		return r;
> -	}
> +	if (r < 0)
> +		goto out_put_kvm;
>  #endif
>  	r = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR | O_CLOEXEC);
>  	if (r < 0)
> -		kvm_put_kvm(kvm);
> +		goto out_mmio_free;

kvm_put_kvm -> kvm_destroy_vm -> kvm_coalesced_mmio_free.


  reply	other threads:[~2015-02-24 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  4:58 [PATCH] KVM: fix possible coalesced_mmio_ring page leaks Xiubo Li
2015-02-24 16:44 ` Marcelo Tosatti [this message]
2015-02-26  2:29   ` Xiubo 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=20150224164359.GA31733@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lixiubo@cmss.chinamobile.com \
    --cc=pbonzini@redhat.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