DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix use after free issue
@ 2016-10-18 14:38 Yuanhan Liu
  2016-10-21  7:52 ` Yuanhan Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Yuanhan Liu @ 2016-10-18 14:38 UTC (permalink / raw)
  To: dev; +Cc: John McNamara, Yuanhan Liu

Fix the coverity USE_AFTER_FREE issue.

Fixes: a277c7159876 ("vhost: refactor code structure")
Coverity issue: 137884

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.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);
-- 
1.9.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix use after free issue
  2016-10-18 14:38 [dpdk-dev] [PATCH] vhost: fix use after free issue Yuanhan Liu
@ 2016-10-21  7:52 ` Yuanhan Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Yuanhan Liu @ 2016-10-21  7:52 UTC (permalink / raw)
  To: dev; +Cc: John McNamara

On Tue, Oct 18, 2016 at 10:38:06PM +0800, Yuanhan Liu wrote:
> Fix the coverity USE_AFTER_FREE issue.
> 
> Fixes: a277c7159876 ("vhost: refactor code structure")
> Coverity issue: 137884
> 
> Reported-by: John McNamara <john.mcnamara@intel.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

Applied to dpdk-next-virtio.

	--yliu
> ---
>  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);
> -- 
> 1.9.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-21  7:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 14:38 [dpdk-dev] [PATCH] vhost: fix use after free issue Yuanhan Liu
2016-10-21  7:52 ` Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).