chardev/char: fix qemu_chr_is_busy() check
PATCH 1/1 chardev/char: fix qemu_chr_is_busy() check
mux_cnt struct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check.
--- chardev/char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char.c +1 -1
@@ -333,7 +333,7 @@ static bool qemu_chr_is_busy(Chardev *s) {if (CHARDEV_IS_MUX (s)) {MuxChardev *d =MUX_CHARDEV (s); -return d->mux_cnt >=0 ; +return d->mux_cnt >0 ; }else {return s->be !=NULL ; }
Signature · 1 line
2.34.1
Hi Roman
Quoted 9 lines · Roman Penyaev
mux_cntstruct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check.Fixes a4afa548fc6d ("char: move front end handlers in CharBackend")Signed-off-by Roman Penyaev <[email protected]>Cc "Marc-André Lureau" <[email protected]>
That would be worth some new tests for chardev removal. It seems to be lacking. And mux probably need extra fixing. I can take a look if you don't.
thanks
Quoted 22 lines
--- chardev/char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)chardev/char.c +1
-2@@ -333,7 +333,7 @@ static bool qemu_chr_is_busy(Chardev *s) {if (CHARDEV_IS_MUX (s)) {MuxChardev *d =MUX_CHARDEV (s); -return d->mux_cnt >=0 ; +return d->mux_cnt >0 ; }else {return s->be !=NULL ; } --2.34.1
Signature · 1 line
Marc-André Lureau
Quoted 15 lines · On Thu, Oct 10, 2024, 12:20 Marc-André Lureau <[email protected]>…
Hi Roman
Quoted 9 lines · Roman Penyaev
mux_cntstruct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check.Fixes a4afa548fc6d ("char: move front end handlers in CharBackend")Signed-off-by Roman Penyaev <[email protected]>Cc "Marc-André Lureau" <[email protected]>
Quoted 5 lines
Reviewed-by Marc-André Lureau <[email protected]>That would be worth some new tests for chardev removal. It seems to be lacking. And mux probably need extra fixing. I can take a look if you don't.
I assume no one removes mux device, so no one observes the error. Please, go ahead, I'm not sure I do fully understand what exactly should be fixed.
--
Roman
Hi Marc-André,
Quoted 16 lines · Marc-André Lureau
Hi Roman
Quoted 10 lines · Roman Penyaev
mux_cntstruct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check.Fixes a4afa548fc6d ("char: move front end handlers in CharBackend")Signed-off-by Roman Penyaev <[email protected]>Cc "Marc-André Lureau" <[email protected]>
Quoted 3 lines
Reviewed-by Marc-André Lureau <[email protected]>That would be worth some new tests for chardev removal. It seems to be lacking. And mux probably need extra fixing. I can take a look if you don't.
I've just sent an attempt to fix the removal of frontends, plus some test cases. Please take a look.
Thanks.
--
Roman