[dpdk-stable] patch 'malloc: fix realloc copy size' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Wed Dec 11 22:26:25 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/17/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/23419ce110eab670d3e8978187ec1a5d2ea5ff87

Thanks.

Kevin.

---
>From 23419ce110eab670d3e8978187ec1a5d2ea5ff87 Mon Sep 17 00:00:00 2001
From: Xueming Li <xuemingl at mellanox.com>
Date: Tue, 12 Nov 2019 14:50:27 +0000
Subject: [PATCH] malloc: fix realloc copy size

[ upstream commit a029a060369f74f42394301f87489aeb391220ef ]

In rte_realloc, if the old element has pad and need to allocate a new
memory, the padding size was not deducted, so more data was copied to
new data area.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Xueming Li <xuemingl at mellanox.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/librte_eal/common/rte_malloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index 47c2bec72..59b130bed 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -131,5 +131,6 @@ rte_realloc(void *ptr, size_t size, unsigned align)
 	if (new_ptr == NULL)
 		return NULL;
-	const unsigned old_size = elem->size - MALLOC_ELEM_OVERHEAD;
+	/* elem: |pad|data_elem|data|trailer| */
+	const size_t old_size = elem->size - elem->pad - MALLOC_ELEM_OVERHEAD;
 	rte_memcpy(new_ptr, ptr, old_size < size ? old_size : size);
 	rte_free(ptr);
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-11 21:24:15.344727745 +0000
+++ 0033-malloc-fix-realloc-copy-size.patch	2019-12-11 21:24:12.665651259 +0000
@@ -1 +1 @@
-From a029a060369f74f42394301f87489aeb391220ef Mon Sep 17 00:00:00 2001
+From 23419ce110eab670d3e8978187ec1a5d2ea5ff87 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit a029a060369f74f42394301f87489aeb391220ef ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index 413e4aa00..d6026a2b1 100644
+index 47c2bec72..59b130bed 100644
@@ -23 +24 @@
-@@ -151,5 +151,6 @@ rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket)
+@@ -131,5 +131,6 @@ rte_realloc(void *ptr, size_t size, unsigned align)



More information about the stable mailing list