[dpdk-dev] [PATCH] vhost: fix vhost-user init failed
Liu, Yu Y
yu.y.liu at intel.com
Wed Jul 12 04:41:09 CEST 2017
This is needed for RC2 as lots of test cases are affected.
Thanks & Regards,
Yu Liu
-----Original Message-----
From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jens Freimann
Sent: Monday, July 10, 2017 5:48 PM
To: Yang, Zhiyong <zhiyong.yang at intel.com>
Cc: dev at dpdk.org; yliu at fridaylinux.org; maxime.coquelin at redhat.com; Yao, Lei A <lei.a.yao at intel.com>
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 <lei.a.yao at intel.com>
>Signed-off-by: Zhiyong Yang <zhiyong.yang at intel.com>
>---
> 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 <jfreimann at redhat.com>
More information about the dev
mailing list