[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] char-socket: avoid double call tcp_chr_free_connection
From: |
Marc-André Lureau |
Subject: |
Re: [PATCH 3/4] char-socket: avoid double call tcp_chr_free_connection |
Date: |
Wed, 15 Apr 2020 12:35:14 +0200 |
Hi
On Wed, Apr 15, 2020 at 5:31 AM Li Feng <address@hidden> wrote:
>
> double call tcp_chr_free_connection generates a crash.
>
> Signed-off-by: Li Feng <address@hidden>
Could you describe how you reach the "double call".
Even better would be to write a test for it in tests/test-char.c
thanks
> ---
> chardev/char-socket.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index 185fe38dda..43aab8f24b 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -476,6 +476,11 @@ static void tcp_chr_disconnect_locked(Chardev *chr)
> SocketChardev *s = SOCKET_CHARDEV(chr);
> bool emit_close = s->state == TCP_CHARDEV_STATE_CONNECTED;
>
> + /* avoid re-enter when socket read/write error and disconnect event. */
> + if (s->state == TCP_CHARDEV_STATE_DISCONNECTED) {
> + return;
> + }
> +
> tcp_chr_free_connection(chr);
>
> if (s->listener) {
> --
> 2.11.0
>
>
> --
> The SmartX email address is only for business purpose. Any sent message
> that is not related to the business is not authorized or permitted by
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
>
>
>
--
Marc-André Lureau
[PATCH v2] char-socket: initialize reconnect timer only when the timer doesn't start, Li Feng, 2020/04/28
[PATCH 4/4] vhost-user-blk: fix crash in realize process, Li Feng, 2020/04/14