Skip to contentSkip to conversation

chardev: Don't unregister yank upon async path connection failure

PATCH In review Fabiano Rosas 2 participants 5 messages Jun 3 – Aug 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chardev: Don't unregister yank upon async path connection failure

Commit 5c102ac9 ("chardev: Consolidate yank registration") has moved yank registration in the tcp_chr_connect_client_async() path to after the connection is successful. If qio_channel_socket_connect_sync() fails early, there will be no yank registered to be unregistered in the error path, leading to assert.

Remove the now-extraneous unregister.

Fixes 5c102ac9 ("chardev: Consolidate yank registration")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3528

---
 chardev/char-socket.c | 5 -----
 1 file changed, 5 deletions(-)
chardev/char-socket.c +0 -5
index e064b105c5..99e01a4875 100644
@@ -1128,11 +1128,6 @@ 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);
-        if (s->registered_yank) {
-            yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
-                                     char_socket_yank_iochannel,
-                                     QIO_CHANNEL(sioc));
-        }
         check_report_connect_error(chr, err);
         goto cleanup;
     }
Signature · 1 line
2.53.0
#1 lore raw
Quoted 22 lines · Fabiano Rosas

Commit 5c102ac9 ("chardev: Consolidate yank registration") has moved yank registration in the tcp_chr_connect_client_async() path to after the connection is successful. If qio_channel_socket_connect_sync() fails early, there will be no yank registered to be unregistered in the error path, leading to assert.

Remove the now-extraneous unregister.

Fixes 5c102ac9 ("chardev: Consolidate yank registration")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3528

---
 chardev/char-socket.c | 5 -----
 1 file changed, 5 deletions(-)
chardev/char-socket.c +0 -0
index e064b105c5..99e01a4875 100644

chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1131

Quoted 4 lines
chardev/char-socket.c +0 -1
@@ -1128,11 +1128,6 @@ 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);
-        if (s->registered_yank) {

Is "registered_yank" stalled too? shouldn't be set to false to avoid that path and possibly others?

Quoted 10 lines
chardev/char-socket.c +0 -5
-            yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
-                                     char_socket_yank_iochannel,
-                                     QIO_CHANNEL(sioc));
-        }
         check_report_connect_error(chr, err);
         goto cleanup;
     }
--

2.53.0

#2 lore raw
Quoted 24 lines · Marc-André Lureau
Quoted 23 lines · Fabiano Rosas

Commit 5c102ac9 ("chardev: Consolidate yank registration") has moved yank registration in the tcp_chr_connect_client_async() path to after the connection is successful. If qio_channel_socket_connect_sync() fails early, there will be no yank registered to be unregistered in the error path, leading to assert.

Remove the now-extraneous unregister.

Fixes 5c102ac9 ("chardev: Consolidate yank registration")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3528

---
 chardev/char-socket.c | 5 -----
 1 file changed, 5 deletions(-)
chardev/char-socket.c +0 -0
index e064b105c5..99e01a4875 100644
@@ -1128,11 +1128,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
 
Quoted 7 lines

chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1131

Quoted 3 lines
chardev/char-socket.c +0 -1
     if (qio_task_propagate_error(task, &err)) {
         tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
-        if (s->registered_yank) {

Is "registered_yank" stalled too? shouldn't be set to false to avoid that path and possibly others?

No because registered_yank is about the YankInstance. There's no actual tracking of the individual YankFns.

Quoted 10 lines
Quoted 10 lines
chardev/char-socket.c +0 -5
-            yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
-                                     char_socket_yank_iochannel,
-                                     QIO_CHANNEL(sioc));
-        }
         check_report_connect_error(chr, err);
         goto cleanup;
     }
--

2.53.0

#3 lore raw
In reply to Fabiano Rosas
Quoted 22 lines · Fabiano Rosas

Commit 5c102ac9 ("chardev: Consolidate yank registration") has moved yank registration in the tcp_chr_connect_client_async() path to after the connection is successful. If qio_channel_socket_connect_sync() fails early, there will be no yank registered to be unregistered in the error path, leading to assert.

Remove the now-extraneous unregister.

Fixes 5c102ac9 ("chardev: Consolidate yank registration")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3528

---
 chardev/char-socket.c | 5 -----
 1 file changed, 5 deletions(-)
chardev/char-socket.c +0 -0
index e064b105c5..99e01a4875 100644
@@ -1128,11 +1128,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
 

chardev/char-socket.c static void qemu_chr_socket_connected(QIOTask *task, void *opaque) · line 1133

Quoted 10 lines
chardev/char-socket.c +0 -5
     if (qio_task_propagate_error(task, &err)) {
         tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
-        if (s->registered_yank) {
-            yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
-                                     char_socket_yank_iochannel,
-                                     QIO_CHANNEL(sioc));
-        }
         check_report_connect_error(chr, err);
         goto cleanup;
     }

ping

Reviewed-by on v1 1/1
#4 lore raw
In reply to Fabiano Rosas
Quoted 7 lines · Fabiano Rosas

Commit 5c102ac9 ("chardev: Consolidate yank registration") has moved yank registration in the tcp_chr_connect_client_async() path to after the connection is successful. If qio_channel_socket_connect_sync() fails early, there will be no yank registered to be unregistered in the error path, leading to assert.

Quoted 6 lines

Remove the now-extraneous unregister.

Fixes 5c102ac9 ("chardev: Consolidate yank registration")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3528

Quoted 24 lines
---
 chardev/char-socket.c | 5 -----
 1 file changed, 5 deletions(-)
chardev/char-socket.c +0 -6
index e064b105c5..99e01a4875 100644
@@ -1128,11 +1128,6 @@ 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);
-        if (s->registered_yank) {
-            yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label),
-                                     char_socket_yank_iochannel,
-                                     QIO_CHANNEL(sioc));
-        }
         check_report_connect_error(chr, err);
         goto cleanup;
     }
--

2.53.0