vhost: fix use after free

A "return" is missing on error, which could lead to a "use after free"
issue (about var "conn").

Coverity issue: 143476
Fixes: 65388b43f5 ("vhost: fix fd leaks for vhost-user server mode")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Yuanhan Liu 2017-04-17 15:27:04 +08:00
parent 4bf9e26d29
commit 7bd841b269

View File

@ -242,6 +242,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
RTE_LOG(ERR, VHOST_CONFIG,
"failed to add fd %d into vhost server fdset\n",
fd);
return;
}
pthread_mutex_lock(&vsocket->conn_mutex);