qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] chardev: don't forget to set backend for mux
@ 2017-11-03 13:19 Kirill A. Shutemov
  2017-11-03 14:05 ` Marc-André Lureau
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill A. Shutemov @ 2017-11-03 13:19 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau
  Cc: qemu-devel, kirill, Kirill A. Shutemov

I noticied that on recent versions on QEMU I was not able to trigger
SysRq to invoke debug capabilites of Linux Kernel.

I've tracked it down to qemu_chr_be_event() ignoring CHR_EVENT_BREAK due
s->be being NULL.

Looks like the bug was introduced in a4afa548fc6d ("char: move front end
handlers in CharBackend"). Since the commit the qemu_chr_be_event()
failed to deliver CHR_EVENT_BREAK due to qemu_chr_fe_init() forgot to
get s->be initialized in case of mux.

Let's fix this.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend")
---
 chardev/char-fe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index ee6d59610031..d4a54947a567 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -209,9 +209,8 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp)
         tag = d->mux_cnt++;
     } else if (s->be) {
         goto unavailable;
-    } else {
-        s->be = b;
     }
+    s->be = b;
 
     b->fe_open = false;
     b->tag = tag;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] chardev: don't forget to set backend for mux
  2017-11-03 13:19 [Qemu-devel] [PATCH] chardev: don't forget to set backend for mux Kirill A. Shutemov
@ 2017-11-03 14:05 ` Marc-André Lureau
  0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2017-11-03 14:05 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: Paolo Bonzini, kirill, QEMU

Hi

On Fri, Nov 3, 2017 at 2:19 PM, Kirill A. Shutemov
<kirill.shutemov@linux.intel.com> wrote:
> I noticied that on recent versions on QEMU I was not able to trigger
> SysRq to invoke debug capabilites of Linux Kernel.
>
> I've tracked it down to qemu_chr_be_event() ignoring CHR_EVENT_BREAK due
> s->be being NULL.
>
> Looks like the bug was introduced in a4afa548fc6d ("char: move front end
> handlers in CharBackend"). Since the commit the qemu_chr_be_event()
> failed to deliver CHR_EVENT_BREAK due to qemu_chr_fe_init() forgot to
> get s->be initialized in case of mux.
>
> Let's fix this.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend")
> ---
>  chardev/char-fe.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/chardev/char-fe.c b/chardev/char-fe.c
> index ee6d59610031..d4a54947a567 100644
> --- a/chardev/char-fe.c
> +++ b/chardev/char-fe.c
> @@ -209,9 +209,8 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp)
>          tag = d->mux_cnt++;
>      } else if (s->be) {
>          goto unavailable;
> -    } else {
> -        s->be = b;
>      }
> +    s->be = b;

This will send the event to the last frontend that called
chr_fe_init(). Instead, it should probably send it to the one with
focus. I am sending an alternative patch.

thanks

>
>      b->fe_open = false;
>      b->tag = tag;
> --
> 2.14.2
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-03 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 13:19 [Qemu-devel] [PATCH] chardev: don't forget to set backend for mux Kirill A. Shutemov
2017-11-03 14:05 ` Marc-André Lureau

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).