Skip to content

Commit

Permalink
Revert "KVM: release anon file in failure path of vm creation"
Browse files Browse the repository at this point in the history
This reverts commit 77ecc085fed1af1000ca719522977b960aa6da52.

Al Viro colorfully says: "You should *NEVER* use sys_close() on failure
exit paths like that.  Moreover, this kvm_put_kvm() becomes a double-put,
since closing the damn file will drop that reference to kvm.  Please,
revert.  anon_inode_getfd() should be used only when there's no possible
failures past its call".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Paolo Bonzini committed Jul 14, 2016
1 parent 2be5b3f commit 7964218
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/bsearch.h>
#include <linux/syscalls.h>

#include <asm/processor.h>
#include <asm/io.h>
Expand Down Expand Up @@ -3070,7 +3069,6 @@ 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;
}

Expand Down

0 comments on commit 7964218

Please sign in to comment.