From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 197727CAC for ; Mon, 10 Jul 2017 11:48:33 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24F3AC0587F6; Mon, 10 Jul 2017 09:48:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 24F3AC0587F6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfreimann@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 24F3AC0587F6 Received: from localhost (dhcp-192-218.str.redhat.com [10.33.192.218]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A56CF62930; Mon, 10 Jul 2017 09:48:28 +0000 (UTC) Date: Mon, 10 Jul 2017 11:48:27 +0200 From: Jens Freimann To: Zhiyong Yang Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com, lei.a.yao@intel.com Message-ID: <20170710094827.zdykowebtm3m3w2k@dhcp-192-218.str.redhat.com> References: <20170710080648.63443-1-zhiyong.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170710080648.63443-1-zhiyong.yang@intel.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Jul 2017 09:48:33 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: fix vhost-user init failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 09:48:34 -0000 On Mon, Jul 10, 2017 at 04:06:48PM +0800, Zhiyong Yang wrote: >Exception handling is executed in the normal path and it will cause >vhost-user init failure. >Fixes: d6983a70e259("vhost: check return of pthread calls") > >Reported-by: Lei Yao >Signed-off-by: Zhiyong Yang >--- > lib/librte_vhost/socket.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c >index 57b86c0..9d2049c 100644 >--- a/lib/librte_vhost/socket.c >+++ b/lib/librte_vhost/socket.c >@@ -668,7 +668,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > } > > vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket; >- >+ goto out; > out_mutex: > if (pthread_mutex_destroy(&vsocket->conn_mutex)) { > RTE_LOG(ERR, VHOST_CONFIG, Thanks for fixing this! Sorry for introducing this bug, I was about to send this before I saw your fix: diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 57b86c0..b2158a7 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -668,6 +668,9 @@ rte_vhost_driver_register(const char *path, uint64_t flags) } vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket; +out: + pthread_mutex_unlock(&vhost_user.mutex); + return ret; out_mutex: if (pthread_mutex_destroy(&vsocket->conn_mutex)) { @@ -677,9 +680,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) out_free: free(vsocket->path); free(vsocket); -out: pthread_mutex_unlock(&vhost_user.mutex); - return ret; } Both works fine, so I leave it up to the maintainers how to fix. Reviewed-by: Jens Freimann