[dpdk-stable] patch 'net/ring: check internal arguments' has been queued to LTS release 18.11.11

Kevin Traynor ktraynor at redhat.com
Wed Nov 18 17:34:59 CET 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.11

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

Thanks.

Kevin.

---
>From cb44dd60e03785d22d3b08a6af740d3888d6f404 Mon Sep 17 00:00:00 2001
From: Kevin Laatz <kevin.laatz at intel.com>
Date: Tue, 13 Oct 2020 14:07:04 +0100
Subject: [PATCH] net/ring: check internal arguments

[ upstream commit e37bbe212d48a7375a6239478a114829d05692b5 ]

Add a check for the return value of the sscanf call in
parse_internal_args(), returning an error if we don't get the expected
result.

Coverity issue: 362049
Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")

Signed-off-by: Kevin Laatz <kevin.laatz at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/ring/rte_eth_ring.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 7298ee93e2..245029c107 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -17,4 +17,5 @@
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
 #define ETH_RING_INTERNAL_ARG		"internal"
+#define ETH_RING_INTERNAL_ARG_MAX_LEN	19 /* "0x..16chars..\0" */
 
 static const char *valid_arguments[] = {
@@ -542,6 +543,19 @@ parse_internal_args(const char *key __rte_unused, const char *value,
 	struct ring_internal_args **internal_args = data;
 	void *args;
+	int ret, n;
 
-	sscanf(value, "%p", &args);
+	/* make sure 'value' is valid pointer length */
+	if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >=
+			ETH_RING_INTERNAL_ARG_MAX_LEN) {
+		PMD_LOG(ERR, "Error parsing internal args, argument is too long");
+		return -1;
+	}
+
+	ret = sscanf(value, "%p%n", &args, &n);
+	if (ret == 0 || (size_t)n != strlen(value)) {
+		PMD_LOG(ERR, "Error parsing internal args");
+
+		return -1;
+	}
 
 	*internal_args = args;
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-18 16:33:38.229371101 +0000
+++ 0013-net-ring-check-internal-arguments.patch	2020-11-18 16:33:37.915215053 +0000
@@ -1 +1 @@
-From e37bbe212d48a7375a6239478a114829d05692b5 Mon Sep 17 00:00:00 2001
+From cb44dd60e03785d22d3b08a6af740d3888d6f404 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e37bbe212d48a7375a6239478a114829d05692b5 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 83c5502123..22c0802688 100644
+index 7298ee93e2..245029c107 100644
@@ -30 +31 @@
-@@ -572,6 +573,19 @@ parse_internal_args(const char *key __rte_unused, const char *value,
+@@ -542,6 +543,19 @@ parse_internal_args(const char *key __rte_unused, const char *value,



More information about the stable mailing list