From patchwork Mon Aug 12 15:58:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Shinkevich X-Patchwork-Id: 11090073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37E7C746 for ; Mon, 12 Aug 2019 15:59:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271DB27FE4 for ; Mon, 12 Aug 2019 15:59:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19F7F2844C; Mon, 12 Aug 2019 15:59:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D770427FE4 for ; Mon, 12 Aug 2019 15:59:13 +0000 (UTC) Received: from localhost ([::1]:46782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxCj3-0006uY-8i for patchwork-qemu-devel@patchwork.kernel.org; Mon, 12 Aug 2019 11:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49433) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxCib-0005j6-Sd for qemu-devel@nongnu.org; Mon, 12 Aug 2019 11:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxCia-0007tq-R8 for qemu-devel@nongnu.org; Mon, 12 Aug 2019 11:58:45 -0400 Received: from relay.sw.ru ([185.231.240.75]:46396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hxCia-0007si-KG for qemu-devel@nongnu.org; Mon, 12 Aug 2019 11:58:44 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hxCiV-0001HP-Ra; Mon, 12 Aug 2019 18:58:39 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 18:58:27 +0300 Message-Id: <1565625509-404969-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v4 0/2] char-socket: Fix race condition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, berrange@redhat.com, berto@igalia.com, marcandre.lureau@redhat.com, andrey.shinkevich@virtuozzo.com, pbonzini@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This fixes a race condition in which the tcp_chr_read() ioc handler can close a connection that is being written to from another thread. v4: The functions qemu_idle_add() and tcp_chr_be_event_closed() were removed because the callback is invoked after the call to object_property_del_all() so, the "chardev" object had been deleted and the segmentation fault occurs. Let's please apply the Alberto's simplified series to avoid the race condition. v3: See the email thread with the Message ID Alberto Garcia (2): main-loop: Fix GSource leak in qio_task_thread_worker() char-socket: Lock tcp_chr_disconnect() chardev/char-socket.c | 16 +++++++++++++--- io/task.c | 1 + 2 files changed, 14 insertions(+), 3 deletions(-)