]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tool: Don't close not yet opened files and SIGSEV fix
authorCyrill Gorcunov <gorcunov@openvz.org>
Sun, 5 Feb 2012 20:19:02 +0000 (00:19 +0400)
committerPekka Enberg <penberg@kernel.org>
Mon, 6 Feb 2012 10:17:37 +0000 (12:17 +0200)
commit3dfcb6ec85d5430622c8b99ca05451c1afd08bf5
tree4512c00bd2713543a5717c72b7fc691bbd356b62
parentc929ceec678765a9a7c6e769e9a99ba79ac9fcd2
kvm tool: Don't close not yet opened files and SIGSEV fix

In case if there error happened in kvm__init and we have
no files opened -- we should not try to close them.

Also once kvm failed to init the caller should not try
to dereference a pointer obtained, otherwise we might get
SIGSEV

 | [cyrill@moon kvm]$ ./lkvm run ...
 | Error: '/dev/kvm' not found. Please make sure your kernel has CONFIG_KVM
 | enabled and that the KVM modules are loaded.
 | Segmentation fault (core dumped)
 | [cyrill@moon kvm]$

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-run.c
tools/kvm/kvm.c