All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, paolo.bonzini@gmail.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 2/3] qapi: fix crash when a parameter is missing
Date: Thu, 29 Sep 2016 17:42:38 +0200	[thread overview]
Message-ID: <87twcy4sr5.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20160922203927.28241-3-marcandre.lureau@redhat.com> ("Marc-André Lureau"'s message of "Fri, 23 Sep 2016 00:39:26 +0400")

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Calling:
>
> { "execute": "qom-set",
>   "arguments": { "path": "/machine", "property": "rtc-time" } }
>
> Will crash with:
>
> qapi/qapi-visit-core.c:277: visit_type_any: Assertion `!err != !*obj'
> failed

This is actually a recent regression.  Let's add "Broken in commit
5c678ee."  Can do on commit.

> Clear the obj and return an error.
>
> The patch also fixes a similar potential crash in qmp_input_type_null()
> by checking qmp_input_get_object() returned a valid qobj.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  qapi/qmp-input-visitor.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
> index 64dd392..fc91e74 100644
> --- a/qapi/qmp-input-visitor.c
> +++ b/qapi/qmp-input-visitor.c
> @@ -338,6 +338,12 @@ static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
>      QmpInputVisitor *qiv = to_qiv(v);
>      QObject *qobj = qmp_input_get_object(qiv, name, true);
>  
> +    if (!qobj) {
> +        error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
> +        *obj = NULL;
> +        return;
> +    }
> +
>      qobject_incref(qobj);
>      *obj = qobj;
>  }
> @@ -347,6 +353,11 @@ static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
>      QmpInputVisitor *qiv = to_qiv(v);
>      QObject *qobj = qmp_input_get_object(qiv, name, true);
>  
> +    if (!qobj) {
> +        error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
> +        return;
> +    }
> +
>      if (qobject_type(qobj) != QTYPE_QNULL) {
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
>                     "null");

  reply	other threads:[~2016-09-29 15:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 20:39 [Qemu-devel] [PATCH v4 0/3] Fix some qapi assert() Marc-André Lureau
2016-09-22 20:39 ` [Qemu-devel] [PATCH v4 1/3] qmp: fix object-add assert() without props Marc-André Lureau
2016-09-23  6:52   ` Xiao Long Jiang
2016-09-29 15:23     ` Markus Armbruster
2016-10-05 10:27       ` Christian Borntraeger
2016-10-10  6:49       ` Xiao Long Jiang
2016-10-05  7:47   ` Markus Armbruster
2016-09-22 20:39 ` [Qemu-devel] [PATCH v4 2/3] qapi: fix crash when a parameter is missing Marc-André Lureau
2016-09-29 15:42   ` Markus Armbruster [this message]
2016-10-05  8:18     ` Markus Armbruster
2016-10-05  8:34       ` Marc-André Lureau
2016-09-22 20:39 ` [Qemu-devel] [PATCH v4 3/3] tests: start generic qemu-qmp tests Marc-André Lureau
2016-09-29 16:28   ` Markus Armbruster
2016-10-05  9:56   ` Markus Armbruster
2016-10-05 10:16     ` Marc-André Lureau
2016-10-05 12:35       ` Markus Armbruster
2016-10-05 13:02         ` Marc-André Lureau
2016-10-05 14:38           ` Markus Armbruster
2016-10-05 15:14             ` Marc-André Lureau
2016-10-06 13:26               ` Markus Armbruster
2016-10-07 18:15   ` Markus Armbruster
2016-10-10  8:24     ` Marc-André Lureau
2016-10-10 13:14       ` Markus Armbruster
2016-10-04 15:23 ` [Qemu-devel] [PATCH 2.5/3] tests/test-qmp-input-strict: Cover missing struct members Markus Armbruster
2016-10-04 16:34   ` no-reply
2016-10-06 13:26 ` [Qemu-devel] [PATCH v4 0/3] Fix some qapi assert() 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=87twcy4sr5.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=paolo.bonzini@gmail.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 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.