From: Luiz Capitulino <lcapitulino@redhat.com>
To: Alon Levy <alevy@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC] monitor: fix segfault from uninitialized lexer->emit
Date: Tue, 30 Aug 2011 15:45:42 -0300 [thread overview]
Message-ID: <20110830154542.337a3f96@doriath> (raw)
In-Reply-To: <1312964409-10698-1-git-send-email-alevy@redhat.com>
On Wed, 10 Aug 2011 11:20:09 +0300
Alon Levy <alevy@redhat.com> wrote:
> The following triggers a call to monitor_control_read before
> monitor_control_event has been called. This patch is misplaced but
> fixes the problem by moving the json_message_parser_init call before
> setting the chardev handlers.
>
> (echo '{"execute": "qmp_capabilities"}'; echo '{"execute":"query-spice"}'; echo '{ "execute": "quit" }') | qemu-system-x86_64 -spice port=9999 -qmp stdio
What's happening is that the CHR_EVENT_OPENED event is not being emitted. I took
a look at the code and it's not clear to me why.
Does anyone know if this is expected or is it a bug in the chardev layer?
>
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> monitor.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 1b8ba2c..6e3d970 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -5190,8 +5190,6 @@ static void monitor_control_event(void *opaque, int event)
>
> switch (event) {
> case CHR_EVENT_OPENED:
> - mon->mc->command_mode = 0
> - json_message_parser_init(&mon->mc->parser, handle_qmp_command);
> data = get_qmp_greeting();
> monitor_json_emitter(mon, data);
> qobject_decref(data);
> @@ -5272,6 +5270,8 @@ void monitor_init(CharDriverState *chr, int flags)
>
> if (monitor_ctrl_mode(mon)) {
> mon->mc = qemu_mallocz(sizeof(MonitorControl));
> + mon->mc->command_mode = 0;
> + json_message_parser_init(&mon->mc->parser, handle_qmp_command);
> /* Control mode requires special handlers */
> qemu_chr_add_handlers(chr, monitor_can_read, monitor_control_read,
> monitor_control_event, mon);
prev parent reply other threads:[~2011-08-30 18:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 8:20 [Qemu-devel] [RFC] monitor: fix segfault from uninitialized lexer->emit Alon Levy
2011-08-30 18:45 ` Luiz Capitulino [this message]
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=20110830154542.337a3f96@doriath \
--to=lcapitulino@redhat.com \
--cc=alevy@redhat.com \
--cc=amit.shah@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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).