chardev: don't forget to set backend for mux
PATCH 1/1 chardev: don't forget to set backend for mux
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.
--- chardev/char-fe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
chardev/char-fe.c +1 -2
@@ -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;
Signature · 1 line
2.14.2
Hi
Quoted 24 lines · 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()ignoringCHR_EVENT_BREAKdues->bebeing NULL.Looks like the bug was introduced in
a4afa548fc6d("char: move front end handlers in CharBackend"). Since the commit theqemu_chr_be_event()failed to deliverCHR_EVENT_BREAKdue toqemu_chr_fe_init()forgot to gets->beinitialized in case of mux.Let's fix this.
Signed-off-by Kirill A. Shutemov <[email protected]>Fixes a4afa548fc6d ("char: move front end handlers in CharBackend")--- chardev/char-fe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)chardev/char-fe.c +0
-0
chardev/char-fe.c bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp) · line 213
Quoted 7 lines
chardev/char-fe.c +1
-2@@ -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
Quoted 7 lines
chardev/char-fe.c +0
-1b->fe_open = false; b->tag = tag; --2.14.2
Signature · 1 line
Marc-André Lureau