qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
	lcapitulino@redhat.com, qemu-stable@nongnu.org,
	mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] qapi: fix null pointer dereference on invalid parameter
Date: Wed, 07 May 2014 16:16:45 +0200	[thread overview]
Message-ID: <536A404D.9090000@kamp.de> (raw)
In-Reply-To: <5369A2E2.3010604@redhat.com>

On 07.05.2014 05:05, Eric Blake wrote:
> On 05/06/2014 06:24 PM, Peter Lieven wrote:
>> qemu segfaults if it receives an invalid parameter via a
>> qmp command instead of throwing an error.
>>
>> For example:
>> { "execute": "blockdev-add",
>>      "arguments": { "options" : { "driver": "invalid-driver" } } }
>>
>> CC: qemu-stable@nongnu.org
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> ---
>>   qapi/qapi-dealloc-visitor.c |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
> Does this overlap with any of Markus' work? It emphasizes how bad it is
> that our visitor interface callbacks are undocumented on what they can
> be passed and are expected to return.
>
> https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg00225.html
>
>> diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c
>> index d0ea118..dc53545 100644
>> --- a/qapi/qapi-dealloc-visitor.c
>> +++ b/qapi/qapi-dealloc-visitor.c
>> @@ -131,7 +131,9 @@ static void qapi_dealloc_end_list(Visitor *v, Error **errp)
>>   static void qapi_dealloc_type_str(Visitor *v, char **obj, const char *name,
>>                                     Error **errp)
>>   {
>> -    g_free(*obj);
>> +    if (obj) {
>> +        g_free(*obj);
>> +    }
>>   }
> As for solving a crash,
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> But if Markus' cleanups solve the problem by guaranteeing that the
> cleanup visitor is never passed a NULL obj, then this would be a dead
> check.  I'm not familiar enough with the rest of the visitor code to
> know whether the caller is at fault, or whether other callers or visitor
> callbacks have the same bug.
>


Markus, can you advise please.

Peter

  reply	other threads:[~2014-05-07 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07  0:24 [Qemu-devel] [PATCH] qapi: fix null pointer dereference on invalid parameter Peter Lieven
2014-05-07  3:05 ` Eric Blake
2014-05-07 14:16   ` Peter Lieven [this message]
2014-05-07 16:55     ` Markus Armbruster
2014-05-07 18:39       ` Luiz Capitulino
2014-05-07 19:32         ` Markus Armbruster

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=536A404D.9090000@kamp.de \
    --to=pl@kamp.de \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).