[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/1] chardev: convert the socket server to QI
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/1] chardev: convert the socket server to QIONetListener |
Date: |
Wed, 20 Dec 2017 17:23:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 19/12/2017 09:48, Paolo Bonzini wrote:
> On 18/12/2017 14:54, Daniel P. Berrange wrote:
>> Instead of creating a QIOChannelSocket directly for the chardev
>> server socket, use a QIONetListener. This provides the ability
>> to listen on multiple sockets at the same time, so enables
>> full support for IPv4/IPv6 dual stack.
>>
>> Signed-off-by: Daniel P. Berrange <address@hidden>
>> ---
>> chardev/char-socket.c | 72
>> +++++++++++++++++++++------------------------------
>> 1 file changed, 29 insertions(+), 43 deletions(-)
>
> Queued, thanks.
I think this has to be squashed in to avoid use-after-free issues left and right
(visible with test-hmp):
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 2d2252a..630a7f2 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -930,6 +930,7 @@ static void qmp_chardev_open_socket(Chardev *chr,
if (qio_net_listener_open_sync(s->listener, s->addr, errp) < 0) {
object_unref(OBJECT(s->listener));
+ s->listener = NULL;
goto error;
}
Paolo
>
> As a follow-up, it's probably worth creating two new functions for
> respectively tcp_chr_set_client_ioc_name+tcp_chr_new_client and
> tcp_chr_set_client_ioc_name+qio_channel_socket_connect_async
> (with tcp_chr_set_client_ioc_name inlined).
>
> Paolo
>