Thread (2 messages) 2 messages, 2 authors, 2016-10-19

[PATCH] vhost: use after free

flat view
STALE3640d

From: Chas Williams <3chas3@gmail.com>
Date: 2016-10-19 16:09:56
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

Don't dereference freed memory.

Fixes: a277c7159876 ("vhost: refactor code structure")

Signed-off-by: Chas Williams <3chas3@gmail.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 967cb65..aaa9c27 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -250,8 +250,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
 		vsocket->connfd = -1;
 		close(connfd);
 		*remove = 1;
-		free(conn);
 		vhost_destroy_device(conn->vid);
+		free(conn);
 
 		if (vsocket->reconnect)
 			vhost_user_create_client(vsocket);
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help