patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Jim Harris <james.r.harris@intel.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'vfio: fix leak with multiprocess' has been queued to LTS release 18.11.6
Date: Tue,  3 Dec 2019 18:26:47 +0000	[thread overview]
Message-ID: <20191203182714.17297-38-ktraynor@redhat.com> (raw)
In-Reply-To: <20191203182714.17297-1-ktraynor@redhat.com>

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@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@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@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@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)


  parent reply	other threads:[~2019-12-03 18:28 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 18:26 [dpdk-stable] patch 'ethdev: remove redundant device info cleanup before get' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/sfc: fix missing notification on link status change' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix slave request fd leak' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix link speed update in broadcast mode' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'app/testpmd: fix crash on port reset' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: forbid reallocation when running' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring address handling during live migration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: protect vring access done by application' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/vhost: fix redundant queue state event' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring memory partially mapped' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: fix Rx stats with vectorized functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: get all pending Rx packets in vectorized paths' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/mlx5: fix BlueField VF type recognition' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: add prefix to global functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix null access when allocating CLIP entry' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix slot allocation for IPv6 flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix parsing VLAN ID rewrite action' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix prefetch for non-coalesced Tx packets' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: avoid polling link status before device start' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/ixgbe: fix X553 speed capability' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/i40e: set speed to undefined for default case' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix slave id types' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix OOB access in other aggregator modes' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/null: fix multi-process Rx and Tx' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: remove duplicate barrier' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: replace memory barrier for doorbell response' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: enforce IO barrier for doorbell command' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix flow steering' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix accessing variable before null check' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/szedata2: fix dependency " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix multicast filter programming' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/qede: limit Rx ring index read for debug' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/atlantic: add FW mailbox guard mutex' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix races on flow API operations' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/sw: fix xstats reset value' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa2: fix default queue configuration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'build: avoid overlinking' " Kevin Traynor
2019-12-03 18:26 ` Kevin Traynor [this message]
2019-12-03 18:26 ` [dpdk-stable] patch 'service: use log for error messages' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/mbuf: fix forged mbuf in clone test' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/ppc: fix 64-bit atomic exchange operation' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'devtools: fix cleanup of checkpatch temporary file' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa: fix number of supported atomic flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/lpm: fix measured cycles for delete' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/linux: restore specific hugepage ordering for ppc' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal: remove dead code on NUMA node detection' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/dpaa_sec: fix auth-cipher check for AEAD' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'cryptodev: fix checks related to device id' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'doc: fix typo in l2fwd-crypto guide' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/qat: fix null auth when using VFIO' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'crypto/qat: fix AES CMAC mininum digest size' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'lib/distributor: fix deadlock on aarch64' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/distributor: fix spurious failure' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'bus/pci: remove useless link dependency on ethdev' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/mlx5: validate flow rule item order' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC related cases' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC timeout unit' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/enic: fix probe for secondary process' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/enic: fix crash in " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/tap: fix blocked Rx packets' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: return error if setting link up fails' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: remove unnecessary variable assignment' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/qede/base: fix page index for PBL chains' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: fix dereference before null check' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: cleanup comments' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203182714.17297-38-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=james.r.harris@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).