From 88e2d78a20fae4cccde351e38e0b1ef534ad3302 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 25 Oct 2018 12:49:10 +0200 Subject: [PATCH] vfio: fix read of freed memory on getting container fd We were reading some memory just after freeing it. Fixes: 83a73c5fef66 ("vfio: use generic multi-process channel") Cc: stable@dpdk.org Signed-off-by: Darek Stojaczyk Acked-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 7d5b96426d..13a8b1811c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -1042,8 +1042,9 @@ rte_vfio_get_container_fd(void) mp_rep = &mp_reply.msgs[0]; p = (struct vfio_mp_param *)mp_rep->param; if (p->result == SOCKET_OK && mp_rep->num_fds == 1) { + vfio_container_fd = mp_rep->fds[0]; free(mp_reply.msgs); - return mp_rep->fds[0]; + return vfio_container_fd; } free(mp_reply.msgs); } -- 2.20.1