From: Xiubo Li <lixiubo@cmss.chinamobile.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: gleb@kernel.org, pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: fix possible coalesced_mmio_ring page leaks.
Date: Thu, 26 Feb 2015 10:29:44 +0800 [thread overview]
Message-ID: <54EE8518.60607@cmss.chinamobile.com> (raw)
In-Reply-To: <20150224164359.GA31733@amt.cnet>
On 25/02/2015 00:44, Marcelo Tosatti wrote:
> 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.
>
Yes, it is.
As in my mind that who use it, it will be whose duty to release it.
Thanks,
BRs
Xiubo
prev parent reply other threads:[~2015-02-26 2:30 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
2015-02-26 2:29 ` Xiubo Li [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=54EE8518.60607@cmss.chinamobile.com \
--to=lixiubo@cmss.chinamobile.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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