From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 23/24] chardev: check if the chardev is registered for yanking
Date: Fri, 5 Feb 2021 07:56:19 +0100 [thread overview]
Message-ID: <20210205065620.1726554-24-kraxel@redhat.com> (raw)
In-Reply-To: <20210205065620.1726554-1-kraxel@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Not all chardevs are created via qmp_chardev_open_socket(), and those
should not call the yank function registration, as this will eventually
assert() not being registered.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210204105232.834642-20-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
chardev/char-socket.c | 53 +++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 20 deletions(-)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 8a707d766c16..9061981f6d3e 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -417,8 +417,9 @@ static void tcp_chr_free_connection(Chardev *chr)
tcp_set_msgfds(chr, NULL, 0);
remove_fd_in_watch(chr);
- if (s->state == TCP_CHARDEV_STATE_CONNECTING
- || s->state == TCP_CHARDEV_STATE_CONNECTED) {
+ if (s->registered_yank &&
+ (s->state == TCP_CHARDEV_STATE_CONNECTING
+ || s->state == TCP_CHARDEV_STATE_CONNECTED)) {
yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
yank_generic_iochannel,
QIO_CHANNEL(s->sioc));
@@ -940,9 +941,11 @@ static int tcp_chr_add_client(Chardev *chr, int fd)
}
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, sioc);
- yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(sioc));
+ if (s->registered_yank) {
+ yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(sioc));
+ }
ret = tcp_chr_new_client(chr, sioc);
object_unref(OBJECT(sioc));
return ret;
@@ -957,9 +960,11 @@ static void tcp_chr_accept(QIONetListener *listener,
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, cioc);
- yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(cioc));
+ if (s->registered_yank) {
+ yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(cioc));
+ }
tcp_chr_new_client(chr, cioc);
}
@@ -975,9 +980,11 @@ static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp)
object_unref(OBJECT(sioc));
return -1;
}
- yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(sioc));
+ if (s->registered_yank) {
+ yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(sioc));
+ }
tcp_chr_new_client(chr, sioc);
object_unref(OBJECT(sioc));
return 0;
@@ -993,9 +1000,11 @@ static void tcp_chr_accept_server_sync(Chardev *chr)
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
sioc = qio_net_listener_wait_client(s->listener);
tcp_chr_set_client_ioc_name(chr, sioc);
- yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(sioc));
+ if (s->registered_yank) {
+ yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(sioc));
+ }
tcp_chr_new_client(chr, sioc);
object_unref(OBJECT(sioc));
}
@@ -1124,9 +1133,11 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
if (qio_task_propagate_error(task, &err)) {
tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
- yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(sioc));
+ if (s->registered_yank) {
+ yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(sioc));
+ }
check_report_connect_error(chr, err);
goto cleanup;
}
@@ -1160,9 +1171,11 @@ static void tcp_chr_connect_client_async(Chardev *chr)
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
sioc = qio_channel_socket_new();
tcp_chr_set_client_ioc_name(chr, sioc);
- yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
- yank_generic_iochannel,
- QIO_CHANNEL(sioc));
+ if (s->registered_yank) {
+ yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
+ yank_generic_iochannel,
+ QIO_CHANNEL(sioc));
+ }
/*
* Normally code would use the qio_channel_socket_connect_async
* method which uses a QIOTask + qio_task_set_error internally
--
2.29.2
next prev parent reply other threads:[~2021-02-05 7:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 6:55 [PULL 00/24] Vga ui 20210205 patches Gerd Hoffmann
2021-02-05 6:55 ` [PULL 01/24] hw/display/qxl: Fix bad printf format specifiers Gerd Hoffmann
2021-02-05 6:55 ` [PULL 02/24] qxl: set qxl.ssd.dcl.con on secondary devices Gerd Hoffmann
2021-02-05 6:55 ` [PULL 03/24] qxl: also notify the rendering is done when skipping it Gerd Hoffmann
2021-02-05 6:56 ` [PULL 04/24] spice: delay starting until display are initialized Gerd Hoffmann
2021-02-05 6:56 ` [PULL 05/24] vhost-user-gpu: check backend for EDID support Gerd Hoffmann
2021-02-05 6:56 ` [PULL 06/24] vhost-user-gpu: handle vhost-user-gpu features in a callback Gerd Hoffmann
2021-02-05 6:56 ` [PULL 07/24] vhost-user-gpu: use an extandable state enum for commands Gerd Hoffmann
2021-02-05 6:56 ` [PULL 08/24] vhost-user-gpu: handle display-info in a callback Gerd Hoffmann
2021-02-05 6:56 ` [PULL 09/24] ui: remove extra #ifdef CONFIG_OPENGL Gerd Hoffmann
2021-02-05 6:56 ` [PULL 10/24] ui: remove gl_ctx_get_current Gerd Hoffmann
2021-02-05 6:56 ` [PULL 11/24] ui: add gd_gl_area_scanout_disable Gerd Hoffmann
2021-02-05 6:56 ` [PULL 12/24] ui: annotate DCLOps callback requirements Gerd Hoffmann
2021-02-05 6:56 ` [PULL 13/24] ui: remove console_has_gl_dmabuf() Gerd Hoffmann
2021-02-05 6:56 ` [PULL 14/24] vhost-user-gpu: add a configuration flag for dmabuf usage Gerd Hoffmann
2021-02-05 6:56 ` [PULL 15/24] ui: add an optional get_flags callback to GraphicHwOps Gerd Hoffmann
2021-02-05 6:56 ` [PULL 16/24] ui: add a DCLOps callback to check dmabuf support Gerd Hoffmann
2021-02-05 6:56 ` [PULL 17/24] ui: check hw requirements during DCL registration Gerd Hoffmann
2021-02-05 6:56 ` [PULL 18/24] ui: add qemu_egl_has_dmabuf helper Gerd Hoffmann
2021-02-05 6:56 ` [PULL 19/24] ui: check gtk-egl dmabuf support Gerd Hoffmann
2021-02-05 6:56 ` [PULL 20/24] ui: add egl dmabuf import to gtkglarea Gerd Hoffmann
2021-02-05 6:56 ` [PULL 21/24] virtio-gpu: avoid re-entering cmdq processing Gerd Hoffmann
2021-02-05 6:56 ` [PULL 22/24] display/ui: add a callback to indicate GL state is flushed Gerd Hoffmann
2021-02-05 6:56 ` Gerd Hoffmann [this message]
2021-02-05 6:56 ` [PULL 24/24] tests: add some virtio-gpu & vhost-user-gpu acceptance test Gerd Hoffmann
2021-02-05 11:56 ` [PULL 00/24] Vga ui 20210205 patches Peter Maydell
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=20210205065620.1726554-24-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=crosa@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/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).