From: Paolo Bonzini <pbonzini@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, borntraeger@de.ibm.com,
frankja@linux.vnet.ibm.com, viro@ZenIV.linux.org.uk
Subject: Re: [PATCH v1 1/1] KVM: add missing kvm_put_kvm in case of failure
Date: Tue, 27 Jun 2017 15:08:32 +0200 [thread overview]
Message-ID: <66c8737e-20f7-627f-a1dd-8139d3304959@redhat.com> (raw)
In-Reply-To: <1498564636-20259-1-git-send-email-imbrenda@linux.vnet.ibm.com>
On 27/06/2017 13:57, Claudio Imbrenda wrote:
> If I'm not missing anything, in case kvm_create_vm_debugfs fails, we
> will have a memory leak due to not freeing the kvm object.
>
> A call to kvm_put_kvm was accidentally removed from an error handling in
> commit 506cfba9e726 ("KVM: don't use anon_inode_getfd() before possible failures")
>
> This patch simply restores the call to kvm_put_kvm, so that the kvm
> object is destroyed before returning an error.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Fixes: 506cfba9e726 ("KVM: don't use anon_inode_getfd() before possible failures")
> ---
> 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 f0fe9d0..257d2a8 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3194,6 +3194,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type)
> if (kvm_create_vm_debugfs(kvm, r) < 0) {
> put_unused_fd(r);
> fput(file);
> + kvm_put_kvm(kvm);
> return -ENOMEM;
> }
>
>
Queued, thanks.
Paolo
next prev parent reply other threads:[~2017-06-27 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 11:57 Claudio Imbrenda
2017-06-27 13:08 ` Paolo Bonzini [this message]
2017-06-27 13:50 ` Al Viro
2017-06-27 13:57 ` Paolo Bonzini
2017-06-27 13:34 ` Al Viro
2017-06-27 13:40 ` Paolo Bonzini
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=66c8737e-20f7-627f-a1dd-8139d3304959@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=frankja@linux.vnet.ibm.com \
--cc=imbrenda@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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
all inboxes | Powered by JetHome®