vhost: fix initialization
authorZhiyong Yang <zhiyong.yang@intel.com>
Mon, 10 Jul 2017 08:06:48 +0000 (16:06 +0800)
committerYuanhan Liu <yliu@fridaylinux.org>
Wed, 19 Jul 2017 19:49:47 +0000 (22:49 +0300)
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@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/socket.c

index 57b86c0..41aa3f9 100644 (file)
@@ -669,6 +669,9 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
 
        vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket;
 
+       pthread_mutex_unlock(&vhost_user.mutex);
+       return ret;
+
 out_mutex:
        if (pthread_mutex_destroy(&vsocket->conn_mutex)) {
                RTE_LOG(ERR, VHOST_CONFIG,