From patchwork Wed Jul 12 02:41:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Yu Y" X-Patchwork-Id: 26851 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 4A771374C; Wed, 12 Jul 2017 04:41:16 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 72E533257 for ; Wed, 12 Jul 2017 04:41:14 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2017 19:41:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,347,1496127600"; d="scan'208";a="126030075" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 11 Jul 2017 19:41:13 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 19:41:12 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 19:41:12 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.197]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Wed, 12 Jul 2017 10:41:10 +0800 From: "Liu, Yu Y" To: Jens Freimann , "Yang, Zhiyong" CC: "dev@dpdk.org" , "yliu@fridaylinux.org" , "maxime.coquelin@redhat.com" , "Yao, Lei A" Thread-Topic: [dpdk-dev] [PATCH] vhost: fix vhost-user init failed Thread-Index: AQHS+VOiUH5O6/F7WEmhqRQqpmam1qJMSpiAgAMy05A= Date: Wed, 12 Jul 2017 02:41:09 +0000 Message-ID: References: <20170710080648.63443-1-zhiyong.yang@intel.com> <20170710094827.zdykowebtm3m3w2k@dhcp-192-218.str.redhat.com> In-Reply-To: <20170710094827.zdykowebtm3m3w2k@dhcp-192-218.str.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2VjODQzNjgtYzIzMy00YmU0LTliOTEtNWVmMDdhNTExNWZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRkRWVoUjJDZGErUXZNOTY1TEV0XC9jaFwvcnNwdlEzVWVyTnRUZUJIdmk3OD0ifQ== dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This is needed for RC2 as lots of test cases are affected. Thanks & Regards, Yu Liu -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jens Freimann Sent: Monday, July 10, 2017 5:48 PM To: Yang, Zhiyong Cc: dev@dpdk.org; yliu@fridaylinux.org; maxime.coquelin@redhat.com; Yao, Lei A Subject: Re: [dpdk-dev] [PATCH] vhost: fix vhost-user init failed 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: 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 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)