patch 'common/cnxk: fix NPC key extraction validation' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Tue Mar 1 11:42:06 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

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

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/6a9b64907ede442468bf05e06f21ca7f1834ecaa

Thanks.

Kevin

---
>From 6a9b64907ede442468bf05e06f21ca7f1834ecaa Mon Sep 17 00:00:00 2001
From: Ankur Dwivedi <adwivedi at marvell.com>
Date: Mon, 7 Feb 2022 11:42:46 +0530
Subject: [PATCH] common/cnxk: fix NPC key extraction validation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 8540d7dbfcbe463c2ae988f92339a8486c5c0587 ]

The x->len is passed as argument to npc_prep_mcam_ldata().
In the function, the len is used to reference elements of
int_info and int_info_mask array.
The arrays are of length NPC_MAX_EXTRACT_DATA_LEN.

Validating the x->len value so that it is not greater than
NPC_MAX_EXTRACT_DATA_LEN.

This patch also resolves warning observed with gcc 12 compiler.

log:
 ../drivers/common/cnxk/roc_npc_utils.c:13:26: warning: writing 16 bytes
 into a region of size 0 [-Wstringop-overflow=]
 ptr[idx] = data[len - 1 - idx];

 ../drivers/common/cnxk/roc_npc_utils.c:163:17: note: at offset 64 into
 destination object ‘int_info’ of size 64
 uint8_t int_info[NPC_MAX_EXTRACT_DATA_LEN];

Bugzilla ID: 854
Fixes: 665b6a7400bf ("common/cnxk: add NPC helper API")

Signed-off-by: Ankur Dwivedi <adwivedi at marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark at marvell.com>
---
 drivers/common/cnxk/roc_npc_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/common/cnxk/roc_npc_utils.c b/drivers/common/cnxk/roc_npc_utils.c
index 26e104c39f..f9768ea3cf 100644
--- a/drivers/common/cnxk/roc_npc_utils.c
+++ b/drivers/common/cnxk/roc_npc_utils.c
@@ -167,4 +167,7 @@ npc_update_extraction_data(struct npc_parse_state *pst,
 
 	x = xinfo;
+	if (x->len > NPC_MAX_EXTRACT_DATA_LEN)
+		return NPC_ERR_INVALID_SIZE;
+
 	len = x->len;
 	hdr_off = x->hdr_off;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-01 10:41:02.742747294 +0000
+++ 0050-common-cnxk-fix-NPC-key-extraction-validation.patch	2022-03-01 10:41:01.333244104 +0000
@@ -1 +1 @@
-From 8540d7dbfcbe463c2ae988f92339a8486c5c0587 Mon Sep 17 00:00:00 2001
+From 6a9b64907ede442468bf05e06f21ca7f1834ecaa Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit 8540d7dbfcbe463c2ae988f92339a8486c5c0587 ]
+
@@ -30 +31,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list