summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorLiu Shuo <shuo.a.liu@intel.com>2016-07-12 11:38:42 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2016-07-14 19:11:21 +0200
commit2be5b3f6dc84d30810cc0a94fa66205c27cf5f42 (patch)
tree0b8eedc0b7829d198467533736fe99d644e436f9 /virt
parentKVM: nVMX: Fix memory corruption when using VMCS shadowing (diff)
downloadlinux-2be5b3f6dc84d30810cc0a94fa66205c27cf5f42.tar.xz
linux-2be5b3f6dc84d30810cc0a94fa66205c27cf5f42.zip
KVM: release anon file in failure path of vm creation
The failure of create debugfs of VM will return directly without release the anon file. It will leak memory and file descriptors, even through be not serious. Signed-off-by: Liu Shuo <shuo.a.liu@intel.com> Fixes: 536a6f88c49dd739961ffd53774775afed852c83 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index dd25346ec356..cc182d9760ed 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -49,6 +49,7 @@
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/bsearch.h>
+#include <linux/syscalls.h>
#include <asm/processor.h>
#include <asm/io.h>
@@ -3069,6 +3070,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type)
if (kvm_create_vm_debugfs(kvm, r) < 0) {
kvm_put_kvm(kvm);
+ sys_close(r);
return -ENOMEM;
}