]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: don't use anon_inode_getfd() before possible failures
authorAl Viro <viro@ZenIV.linux.org.uk>
Thu, 14 Jul 2016 16:54:17 +0000 (18:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2016 17:11:22 +0000 (19:11 +0200)
commit573dd531682caf0fc66906804e35d57d06826505
tree7f6f26ce5413b63c066fe974231be881841e8ffa
parent015241f5ba6b5a43cb0abbb3a9d4d657bf77eef9
KVM: don't use anon_inode_getfd() before possible failures

Once anon_inode_getfd() has succeeded, it's impossible to undo
in a clean way and no, sys_close() is not usable in such cases.
Use anon_inode_getfile() and get_unused_fd_flags() to get struct file
and descriptor and do *not* install the file into the descriptor table
until after the last possible failure exit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c