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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:04:29 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

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

Thanks.

Luca Boccassi

---
>From 2acc78a0a186b598cadcc14b59f8df480d0a6ae9 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 1d815dcd96..285081c86c 100644
--- a/lib/librte_kvargs/rte_kvargs.c
+++ b/lib/librte_kvargs/rte_kvargs.c
@@ -50,7 +50,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)
 			/* Find the end of the list. */
 			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)] = ',';
 				/* Parse until next comma. */
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:49.901634272 +0100
+++ 0134-kvargs-fix-invalid-token-parsing-on-FreeBSD.patch	2020-05-19 14:04:44.444652506 +0100
@@ -1,4 +1,4 @@
-From b2aa2c9723796d81cb9216f3a5c5e195796985fa Mon Sep 17 00:00:00 2001
+From 2acc78a0a186b598cadcc14b59f8df480d0a6ae9 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
@@ -6,6 +6,8 @@
 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.
@@ -15,7 +17,6 @@
 both GNU and FreeBSD libc.
 
 Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list")
-Cc: stable at dpdk.org
 
 Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
 Tested-by: Zhimin Huang <zhiminx.huang at intel.com>


More information about the stable mailing list