Skip to contentSkip to conversation

vhost: use after free

PATCH In review Chas Williams 2 participants 2 messages Oct 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: use after free

Don't dereference freed memory.

Fixes a277c7159876 ("vhost: refactor code structure")
---
 lib/librte_vhost/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_vhost/socket.c +1 -1
index 967cb65..aaa9c27 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Chas Williams
Sent: Wednesday, October 19, 2016 5:10 PM
To: [email protected]
Cc: Chas Williams <[email protected]>
Subject: [dpdk-dev] [PATCH] vhost: use after free

Quoted 3 lines

Don't dereference freed memory.

Fixes a277c7159876 ("vhost: refactor code structure")

Hi Chas,

Thanks for that.

Just to note that there was another patch submitted for this a few hours ago by Yuanhan (CCed):

    http://dpdk.org/dev/patchwork/patch/16674/

John