[dpdk-stable] patch 'vfio: fix leak with multiprocess' has been queued to LTS release 18.11.6
Kevin Traynor
ktraynor at redhat.com
Tue Dec 3 19:26:47 CET 2019
Hi,
FYI, your patch has been queued to LTS release 18.11.6
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/10/19. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/f41e4005bc87dd55595a457e6ccd4667ea31caed
Thanks.
Kevin.
---
>From f41e4005bc87dd55595a457e6ccd4667ea31caed Mon Sep 17 00:00:00 2001
From: Jim Harris <james.r.harris at intel.com>
Date: Fri, 16 Aug 2019 05:13:42 -0700
Subject: [PATCH] vfio: fix leak with multiprocess
[ upstream commit 773a860aef951727ea0c5af0f83e15fb0e24e03d ]
The code checks both rte_mp_request_sync() return code and that the number
of messages in the reply equals 1. If rte_mp_request_sync() succeeds but
there was more than one message, those messages would get leaked.
Found via code review by Anatoly Burakov of patches that used the vhost
code as a template for using rte_mp_request_sync().
Fixes: 83a73c5fef66 ("vfio: use generic multi-process channel")
Reported-by: Anatoly Burakov <anatoly.burakov at intel.com>
Signed-off-by: Jim Harris <james.r.harris at intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
lib/librte_eal/linuxapp/eal/eal_vfio.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 830b320d7..48d2abafa 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -264,5 +264,5 @@ vfio_open_group_fd(int iommu_group_num)
char filename[PATH_MAX];
struct rte_mp_msg mp_req, *mp_rep;
- struct rte_mp_reply mp_reply;
+ struct rte_mp_reply mp_reply = {0};
struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
@@ -320,7 +320,7 @@ vfio_open_group_fd(int iommu_group_num)
vfio_group_fd = 0;
}
- free(mp_reply.msgs);
}
+ free(mp_reply.msgs);
if (vfio_group_fd < 0)
RTE_LOG(ERR, EAL, " cannot request group fd\n");
@@ -554,5 +554,5 @@ vfio_sync_default_container(void)
{
struct rte_mp_msg mp_req, *mp_rep;
- struct rte_mp_reply mp_reply;
+ struct rte_mp_reply mp_reply = {0};
struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
@@ -584,6 +584,6 @@ vfio_sync_default_container(void)
if (p->result == SOCKET_OK)
iommu_type_id = p->iommu_type_id;
- free(mp_reply.msgs);
}
+ free(mp_reply.msgs);
if (iommu_type_id < 0) {
RTE_LOG(ERR, EAL, "Could not get IOMMU type for default container\n");
@@ -1023,5 +1023,5 @@ vfio_get_default_container_fd(void)
{
struct rte_mp_msg mp_req, *mp_rep;
- struct rte_mp_reply mp_reply;
+ struct rte_mp_reply mp_reply = {0};
struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
@@ -1051,7 +1051,7 @@ vfio_get_default_container_fd(void)
return mp_rep->fds[0];
}
- free(mp_reply.msgs);
}
+ free(mp_reply.msgs);
RTE_LOG(ERR, EAL, " cannot request default container fd\n");
return -1;
@@ -1129,5 +1129,5 @@ rte_vfio_get_container_fd(void)
int ret, vfio_container_fd;
struct rte_mp_msg mp_req, *mp_rep;
- struct rte_mp_reply mp_reply;
+ struct rte_mp_reply mp_reply = {0};
struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
@@ -1183,7 +1183,7 @@ rte_vfio_get_container_fd(void)
return vfio_container_fd;
}
- free(mp_reply.msgs);
}
+ free(mp_reply.msgs);
RTE_LOG(ERR, EAL, " cannot request container fd\n");
return -1;
--
2.21.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2019-12-03 17:29:54.023200810 +0000
+++ 0038-vfio-fix-leak-with-multiprocess.patch 2019-12-03 17:29:51.763749682 +0000
@@ -1 +1 @@
-From 773a860aef951727ea0c5af0f83e15fb0e24e03d Mon Sep 17 00:00:00 2001
+From f41e4005bc87dd55595a457e6ccd4667ea31caed Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 773a860aef951727ea0c5af0f83e15fb0e24e03d ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
- lib/librte_eal/linux/eal/eal_vfio.c | 16 ++++++++--------
+ lib/librte_eal/linuxapp/eal/eal_vfio.c | 16 ++++++++--------
@@ -23,5 +24,5 @@
-diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
-index 501c74f23..d9541b122 100644
---- a/lib/librte_eal/linux/eal/eal_vfio.c
-+++ b/lib/librte_eal/linux/eal/eal_vfio.c
-@@ -265,5 +265,5 @@ vfio_open_group_fd(int iommu_group_num)
+diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
+index 830b320d7..48d2abafa 100644
+--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
++++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
+@@ -264,5 +264,5 @@ vfio_open_group_fd(int iommu_group_num)
@@ -34 +35 @@
-@@ -321,7 +321,7 @@ vfio_open_group_fd(int iommu_group_num)
+@@ -320,7 +320,7 @@ vfio_open_group_fd(int iommu_group_num)
@@ -43 +44 @@
-@@ -555,5 +555,5 @@ vfio_sync_default_container(void)
+@@ -554,5 +554,5 @@ vfio_sync_default_container(void)
@@ -50 +51 @@
-@@ -585,6 +585,6 @@ vfio_sync_default_container(void)
+@@ -584,6 +584,6 @@ vfio_sync_default_container(void)
@@ -58 +59 @@
-@@ -1022,5 +1022,5 @@ vfio_get_default_container_fd(void)
+@@ -1023,5 +1023,5 @@ vfio_get_default_container_fd(void)
@@ -65 +66 @@
-@@ -1050,7 +1050,7 @@ vfio_get_default_container_fd(void)
+@@ -1051,7 +1051,7 @@ vfio_get_default_container_fd(void)
@@ -74 +75 @@
-@@ -1128,5 +1128,5 @@ rte_vfio_get_container_fd(void)
+@@ -1129,5 +1129,5 @@ rte_vfio_get_container_fd(void)
@@ -81 +82 @@
-@@ -1182,7 +1182,7 @@ rte_vfio_get_container_fd(void)
+@@ -1183,7 +1183,7 @@ rte_vfio_get_container_fd(void)
More information about the stable
mailing list