[dpdk-stable] patch 'raw/ntb: check memory allocations' has been queued to stable release 20.11.2
Xueming Li
xuemingl at nvidia.com
Sat Jun 12 01:02:58 CEST 2021
Hi,
FYI, your patch has been queued to stable release 20.11.2
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/14/21. 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/steevenlee/dpdk
This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/89bbedc455d0d8337214d9ec5776cc9b0da49c32
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 89bbedc455d0d8337214d9ec5776cc9b0da49c32 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen at huawei.com>
Date: Wed, 21 Apr 2021 10:08:16 +0800
Subject: [PATCH] raw/ntb: check memory allocations
Cc: Luca Boccassi <bluca at debian.org>
[ upstream commit 403f21feb87fc9e0e2f61c1e4576cc1b9300ed4b ]
This patch adds checking for rte_zmalloc() result when init Intel ntb
device, also fix the same bug when start ntb device.
Fixes: 034c328eb025 ("raw/ntb: support Intel NTB")
Fixes: c39d1e082a4b ("raw/ntb: setup queues")
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
Acked-by: Xiaoyun Li <xiaoyun.li at intel.com>
---
drivers/raw/ntb/ntb.c | 5 +++++
drivers/raw/ntb/ntb_hw_intel.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 0f0e3f27a0..6703bb5d08 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -923,6 +923,11 @@ ntb_dev_start(struct rte_rawdev *dev)
hw->peer_mw_base = rte_zmalloc("ntb_peer_mw_base", hw->mw_cnt *
sizeof(uint64_t), 0);
+ if (hw->peer_mw_base == NULL) {
+ NTB_LOG(ERR, "Cannot allocate memory for peer mw base.");
+ ret = -ENOMEM;
+ goto err_q_init;
+ }
if (hw->ntb_ops->spad_read == NULL) {
ret = -ENOTSUP;
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 4427e11458..a742e8fbb9 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -148,6 +148,11 @@ intel_ntb_dev_init(const struct rte_rawdev *dev)
hw->mw_size = rte_zmalloc("ntb_mw_size",
hw->mw_cnt * sizeof(uint64_t), 0);
+ if (hw->mw_size == NULL) {
+ NTB_LOG(ERR, "Cannot allocate memory for mw size.");
+ return -ENOMEM;
+ }
+
for (i = 0; i < hw->mw_cnt; i++) {
bar = intel_ntb_bar[i];
hw->mw_size[i] = hw->pci_dev->mem_resource[bar].len;
--
2.25.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2021-06-12 06:53:58.761055300 +0800
+++ 0084-raw-ntb-check-memory-allocations.patch 2021-06-12 06:53:56.400000000 +0800
@@ -1 +1 @@
-From 403f21feb87fc9e0e2f61c1e4576cc1b9300ed4b Mon Sep 17 00:00:00 2001
+From 89bbedc455d0d8337214d9ec5776cc9b0da49c32 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 403f21feb87fc9e0e2f61c1e4576cc1b9300ed4b ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list