From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 391EAA04A3
	for <public@inbox.dpdk.org>; Fri,  5 Jun 2020 20:25:50 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2E2741D515;
	Fri,  5 Jun 2020 20:25:50 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
 [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id B93B81D510
 for <stable@dpdk.org>; Fri,  5 Jun 2020 20:25:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1591381548;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=wBoYklifty/WKLUFN+xlOc4WP6Yd13zvPuO0CCozJx4=;
 b=Aa6hTSpBYKINmGKaviIGkFF/1ILobNlYMydSua36L1jw4TLM541GZNSsF65um2jgB1W7EL
 Q5XtvcN1QPZdmuFbiy5kt2BknmUParzz9arAuiag6nv1+OfGBzFii7LO9vm/kP5kr1ThK1
 r8zLDBFOlcKgqJhqFwg08XbFgjTz7qk=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-344-oqRL4mG0MFucKFB0w3vsTA-1; Fri, 05 Jun 2020 14:25:45 -0400
X-MC-Unique: oqRL4mG0MFucKFB0w3vsTA-1
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
 [10.5.11.12])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B9551853587;
 Fri,  5 Jun 2020 18:25:44 +0000 (UTC)
Received: from rh.redhat.com (unknown [10.33.36.130])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 5FCF660C47;
 Fri,  5 Jun 2020 18:25:43 +0000 (UTC)
From: Kevin Traynor <ktraynor@redhat.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dpdk stable <stable@dpdk.org>
Date: Fri,  5 Jun 2020 19:24:03 +0100
Message-Id: <20200605182525.22483-6-ktraynor@redhat.com>
In-Reply-To: <20200605182525.22483-1-ktraynor@redhat.com>
References: <20200605182525.22483-1-ktraynor@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'kvargs: fix invalid token parsing on FreeBSD'
	has been queued to LTS release 18.11.9
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

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@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@6wind.com>
Tested-by: Zhimin Huang <zhiminx.huang@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@dpdk.org
@@ -27 +28 @@
-index 1d815dcd96..285081c86c 100644
+index a8a5cb50b9..b6f8a6db87 100644