[dpdk-dev] [PATCH] vhost: fix use after free

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Apr 17 09:27:04 CEST 2017


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

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

Reported-by: John McNamara <john.mcnamara at intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 lib/librte_vhost/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 66fd335..c7f99b0 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -242,6 +242,7 @@ struct vhost_user {
 		RTE_LOG(ERR, VHOST_CONFIG,
 			"failed to add fd %d into vhost server fdset\n",
 			fd);
+		return;
 	}
 
 	pthread_mutex_lock(&vsocket->conn_mutex);
-- 
1.9.0



More information about the dev mailing list