[dpdk-stable] patch 'kvargs: fix invalid token parsing on FreeBSD' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Fri Jun 5 20:24:03 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/10/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/35d679a6265134c2e605e76f8bd9565bbccba333

Thanks.

Kevin.

---
>From 35d679a6265134c2e605e76f8bd9565bbccba333 Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz at 6wind.com>
Date: Wed, 29 Apr 2020 15:17:00 +0200
Subject: [PATCH] kvargs: fix invalid token parsing on FreeBSD
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit b2aa2c9723796d81cb9216f3a5c5e195796985fa ]

The behavior of strtok_r() is not the same between GNU libc and FreeBSD
libc: in the first case, the context is set to "" when the last token is
returned, while in the second case it is set to NULL.

On FreeBSD, the current code crashes because we are dereferencing a NULL
pointer (ctx1). Fix it by first checking if it is NULL. This works with
both GNU and FreeBSD libc.

Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list")

Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
Tested-by: Zhimin Huang <zhiminx.huang at intel.com>
---
 lib/librte_kvargs/rte_kvargs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
index a8a5cb50b9..b6f8a6db87 100644
--- a/lib/librte_kvargs/rte_kvargs.c
+++ b/lib/librte_kvargs/rte_kvargs.c
@@ -51,5 +51,5 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)
 			while (str[strlen(str) - 1] != ']') {
 				/* Restore the comma erased by strtok_r(). */
-				if (ctx1[0] == '\0')
+				if (ctx1 == NULL || ctx1[0] == '\0')
 					return -1; /* no closing bracket */
 				str[strlen(str)] = ',';
-- 
2.21.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-06-05 19:20:51.282061298 +0100
+++ 0006-kvargs-fix-invalid-token-parsing-on-FreeBSD.patch	2020-06-05 19:20:50.706043176 +0100
@@ -1 +1 @@
-From b2aa2c9723796d81cb9216f3a5c5e195796985fa Mon Sep 17 00:00:00 2001
+From 35d679a6265134c2e605e76f8bd9565bbccba333 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit b2aa2c9723796d81cb9216f3a5c5e195796985fa ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -27 +28 @@
-index 1d815dcd96..285081c86c 100644
+index a8a5cb50b9..b6f8a6db87 100644



More information about the stable mailing list