Commit 2be5b3f6 authored by Liu Shuo's avatar Liu Shuo Committed by Paolo Bonzini

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: default avatarLiu Shuo <shuo.a.liu@intel.com>
Fixes: 536a6f88Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 2f1fe811
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sort.h> #include <linux/sort.h>
#include <linux/bsearch.h> #include <linux/bsearch.h>
#include <linux/syscalls.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -3069,6 +3070,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type) ...@@ -3069,6 +3070,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type)
if (kvm_create_vm_debugfs(kvm, r) < 0) { if (kvm_create_vm_debugfs(kvm, r) < 0) {
kvm_put_kvm(kvm); kvm_put_kvm(kvm);
sys_close(r);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment