patch 'mem: check allocation in dynamic hugepage init' has been queued to stable release 20.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 18 13:39:13 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.5

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

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/1b84be5c00418b3fc97988c8e3d5bfaaef8c3cde

Thanks.

Luca Boccassi

---
>From 1b84be5c00418b3fc97988c8e3d5bfaaef8c3cde Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Tue, 14 Dec 2021 21:30:25 +0800
Subject: [PATCH] mem: check allocation in dynamic hugepage init

[ upstream commit 5f69ebbd85300a197bbe9e6a630642352f5aba39 ]

The function malloc() could return NULL, the return value
need to be checked.

Fixes: 6f63858e55e6 ("mem: prevent preallocated pages from being freed")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 lib/librte_eal/common/eal_common_dynmem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_dynmem.c b/lib/librte_eal/common/eal_common_dynmem.c
index 7c5437ddfa..c1e1889f5c 100644
--- a/lib/librte_eal/common/eal_common_dynmem.c
+++ b/lib/librte_eal/common/eal_common_dynmem.c
@@ -304,6 +304,10 @@ eal_dynmem_hugepage_init(void)
 				needed = num_pages - num_pages_alloc;
 
 				pages = malloc(sizeof(*pages) * needed);
+				if (pages == NULL) {
+					RTE_LOG(ERR, EAL, "Failed to malloc pages\n");
+					return -1;
+				}
 
 				/* do not request exact number of pages */
 				cur_pages = eal_memalloc_alloc_seg_bulk(pages,
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-18 12:37:41.797744959 +0000
+++ 0104-mem-check-allocation-in-dynamic-hugepage-init.patch	2022-02-18 12:37:37.834795136 +0000
@@ -1 +1 @@
-From 5f69ebbd85300a197bbe9e6a630642352f5aba39 Mon Sep 17 00:00:00 2001
+From 1b84be5c00418b3fc97988c8e3d5bfaaef8c3cde Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5f69ebbd85300a197bbe9e6a630642352f5aba39 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -15 +16 @@
- lib/eal/common/eal_common_dynmem.c | 4 ++++
+ lib/librte_eal/common/eal_common_dynmem.c | 4 ++++
@@ -18 +19 @@
-diff --git a/lib/eal/common/eal_common_dynmem.c b/lib/eal/common/eal_common_dynmem.c
+diff --git a/lib/librte_eal/common/eal_common_dynmem.c b/lib/librte_eal/common/eal_common_dynmem.c
@@ -20,2 +21,2 @@
---- a/lib/eal/common/eal_common_dynmem.c
-+++ b/lib/eal/common/eal_common_dynmem.c
+--- a/lib/librte_eal/common/eal_common_dynmem.c
++++ b/lib/librte_eal/common/eal_common_dynmem.c


More information about the stable mailing list