[dpdk-stable] patch 'net/ena/base: prevent allocation of zero sized memory' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Thu May 28 18:22:51 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/03/20. 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/5ae6a9d1da8a8082fcb30e942deb91b347650313

Thanks.

Kevin.

---
>From 5ae6a9d1da8a8082fcb30e942deb91b347650313 Mon Sep 17 00:00:00 2001
From: Igor Chauskin <igorch at amazon.com>
Date: Wed, 8 Apr 2020 10:28:54 +0200
Subject: [PATCH] net/ena/base: prevent allocation of zero sized memory

[ upstream commit 29dc10d9424ccf26a346387b0a707185e2432400 ]

rte_memzone_reserve() will reserve the biggest contiguous memzone
available if received 0 as size param.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")

Signed-off-by: Igor Chauskin <igorch at amazon.com>
Reviewed-by: Michal Krawczyk <mk at semihalf.com>
Reviewed-by: Guy Tzalik <gtzalik at amazon.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 29 ++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 1d30dbe2c6..5cc559b4f4 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -178,13 +178,16 @@ extern rte_atomic32_t ena_alloc_cnt;
 #define ENA_MEM_ALLOC_COHERENT(dmadev, size, virt, phys, handle)	\
 	do {								\
-		const struct rte_memzone *mz;				\
-		char z_name[RTE_MEMZONE_NAMESIZE];			\
+		const struct rte_memzone *mz = NULL;			\
 		ENA_TOUCH(dmadev); ENA_TOUCH(handle);			\
-		snprintf(z_name, sizeof(z_name),			\
+		if (size > 0) {						\
+			char z_name[RTE_MEMZONE_NAMESIZE];		\
+			snprintf(z_name, sizeof(z_name),		\
 			 "ena_alloc_%d",				\
 			 rte_atomic32_add_return(&ena_alloc_cnt, 1));	\
-		mz = rte_memzone_reserve(z_name, size, SOCKET_ID_ANY,	\
-				RTE_MEMZONE_IOVA_CONTIG);		\
-		handle = mz;						\
+			mz = rte_memzone_reserve(z_name, size,		\
+					SOCKET_ID_ANY,			\
+					RTE_MEMZONE_IOVA_CONTIG);	\
+			handle = mz;					\
+		}							\
 		if (mz == NULL) {					\
 			virt = NULL;					\
@@ -204,13 +207,15 @@ extern rte_atomic32_t ena_alloc_cnt;
 	dmadev, size, virt, phys, mem_handle, node, dev_node)		\
 	do {								\
-		const struct rte_memzone *mz;				\
-		char z_name[RTE_MEMZONE_NAMESIZE];			\
+		const struct rte_memzone *mz = NULL;			\
 		ENA_TOUCH(dmadev); ENA_TOUCH(dev_node);			\
-		snprintf(z_name, sizeof(z_name),			\
+		if (size > 0) {						\
+			char z_name[RTE_MEMZONE_NAMESIZE];		\
+			snprintf(z_name, sizeof(z_name),		\
 			 "ena_alloc_%d",				\
-			 rte_atomic32_add_return(&ena_alloc_cnt, 1));	\
-		mz = rte_memzone_reserve(z_name, size, node,		\
+			 rte_atomic32_add_return(&ena_alloc_cnt, 1));   \
+			mz = rte_memzone_reserve(z_name, size, node,	\
 				RTE_MEMZONE_IOVA_CONTIG);		\
-		mem_handle = mz;					\
+			mem_handle = mz;				\
+		}							\
 		if (mz == NULL) {					\
 			virt = NULL;					\
-- 
2.21.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-28 17:13:02.416466637 +0100
+++ 0064-net-ena-base-prevent-allocation-of-zero-sized-memory.patch	2020-05-28 17:12:59.140555518 +0100
@@ -1 +1 @@
-From 29dc10d9424ccf26a346387b0a707185e2432400 Mon Sep 17 00:00:00 2001
+From 5ae6a9d1da8a8082fcb30e942deb91b347650313 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 29dc10d9424ccf26a346387b0a707185e2432400 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index 70261bdbc6..4b8fe017dd 100644
+index 1d30dbe2c6..5cc559b4f4 100644
@@ -23 +24 @@
-@@ -185,13 +185,16 @@ extern rte_atomic32_t ena_alloc_cnt;
+@@ -178,13 +178,16 @@ extern rte_atomic32_t ena_alloc_cnt;
@@ -46 +47 @@
-@@ -211,13 +214,15 @@ extern rte_atomic32_t ena_alloc_cnt;
+@@ -204,13 +207,15 @@ extern rte_atomic32_t ena_alloc_cnt;



More information about the stable mailing list