From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Sasha Levin <levinsasha928@gmail.com>,
Asias He <asias.hejun@gmail.com>, Ingo Molnar <mingo@elte.hu>,
KVM-ML <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm tool: Don't close not yet opened files and SIGSEV fix
Date: Sat, 4 Feb 2012 21:48:44 +0400 [thread overview]
Message-ID: <20120204174844.GC14818@moon> (raw)
In-Reply-To: <alpine.LFD.2.02.1202041937570.1809@tux.localdomain>
On Sat, Feb 04, 2012 at 07:38:41PM +0200, Pekka Enberg wrote:
> On Sat, 4 Feb 2012, Cyrill Gorcunov wrote:
> >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>
> >---
> >tools/kvm/builtin-run.c | 4 ++++
> >tools/kvm/kvm.c | 11 ++++++++---
> >2 files changed, 12 insertions(+), 3 deletions(-)
> >
> >Index: linux-2.6.git/tools/kvm/builtin-run.c
> >===================================================================
> >--- linux-2.6.git.orig/tools/kvm/builtin-run.c
> >+++ linux-2.6.git/tools/kvm/builtin-run.c
> >@@ -997,6 +997,10 @@ static int kvm_cmd_run_init(int argc, co
> > }
> >
> > kvm = kvm__init(dev, hugetlbfs_path, ram_size, guest_name);
> >+ if (IS_ERR_OR_NULL(kvm)) {
>
> PTR_ERR is still not going to work if kvm is NULL.
>
It should be IS_ERR rather (kvm__init never returns with NULL),
but it's a candidate for another patch where both kvm__init
and kvm__new should test for IS_ERR only.
Pekka, could you please s/IS_ERR_OR_NULL/IS_ERR/ in this patch,
and that's all. Hm?
Cyrill
next prev parent reply other threads:[~2012-02-04 17:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 16:32 [PATCH] kvm tool: Don't close not yet opened files and SIGSEV fix Cyrill Gorcunov
2012-02-04 17:38 ` Pekka Enberg
2012-02-04 17:48 ` Cyrill Gorcunov [this message]
2012-02-04 17:54 ` Pekka Enberg
2012-02-04 18:02 ` Cyrill Gorcunov
2012-02-05 20:19 ` Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120204174844.GC14818@moon \
--to=gorcunov@openvz.org \
--cc=asias.hejun@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.