double call tcp_chr_free_connection generates a crash. Signed-off-by: Li Feng <fen...@smartx.com> --- 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)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.