From: Liu Shuo Date: Tue, 12 Jul 2016 09:38:42 +0000 (+0800) Subject: KVM: release anon file in failure path of vm creation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2be5b3f6dc84d30810cc0a94fa66205c27cf5f42;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Fixes: 536a6f88c49dd739961ffd53774775afed852c83 Signed-off-by: Paolo Bonzini --- 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 #include #include +#include #include #include @@ -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; }