[dpdk-stable] patch 'net/softnic: fix null dereference in arguments parsing' has been queued to stable release 19.11.10

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Aug 10 17:40:16 CEST 2021


Hi,

FYI, your patch has been queued to stable release 19.11.10

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

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/0eaed422260125d4d542168630bffe74b2462d5e

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 0eaed422260125d4d542168630bffe74b2462d5e Mon Sep 17 00:00:00 2001
From: Dapeng Yu <dapengx.yu at intel.com>
Date: Tue, 27 Jul 2021 16:14:59 +0800
Subject: [PATCH] net/softnic: fix null dereference in arguments parsing

[ upstream commit 51799b4f971982bc0757cf8a11940eb538b1af57 ]

When there is no "firmware" in arguments, the "firmware" pointer is
null, and will be dereferenced by rte_strscpy().

This patch moves the code block which copies character string from
"firmware" to "p->firmware" into the "if" statements where "firmware"
argument exists and it is duplicated successfully.

Coverity issue: 372136
Fixes: d8f852f5f369 ("net/softnic: fix memory leak in arguments parsing")

Signed-off-by: Dapeng Yu <dapengx.yu at intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh at intel.com>
---
 drivers/net/softnic/rte_eth_softnic.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index f4858255ce..5a6947615a 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -479,17 +479,19 @@ pmd_parse_args(struct pmd_params *p, const char *params)
 			&get_string, &firmware);
 		if (ret < 0)
 			goto out_free;
-	}
-	if (rte_strscpy(p->firmware, firmware,
-			sizeof(p->firmware)) < 0) {
-		PMD_LOG(WARNING,
-			"\"%s\": firmware path should be shorter than %zu",
-			firmware, sizeof(p->firmware));
+
+		if (rte_strscpy(p->firmware, firmware,
+				sizeof(p->firmware)) < 0) {
+			PMD_LOG(WARNING,
+				"\"%s\": "
+				"firmware path should be shorter than %zu",
+				firmware, sizeof(p->firmware));
+			free(firmware);
+			ret = -EINVAL;
+			goto out_free;
+		}
 		free(firmware);
-		ret = -EINVAL;
-		goto out_free;
 	}
-	free(firmware);
 	/* Connection listening port (optional) */
 	if (rte_kvargs_count(kvlist, PMD_PARAM_CONN_PORT) == 1) {
 		ret = rte_kvargs_process(kvlist, PMD_PARAM_CONN_PORT,
-- 
2.32.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-08-10 15:11:16.702153440 +0200
+++ 0096-net-softnic-fix-null-dereference-in-arguments-parsin.patch	2021-08-10 15:11:13.130638908 +0200
@@ -1 +1 @@
-From 51799b4f971982bc0757cf8a11940eb538b1af57 Mon Sep 17 00:00:00 2001
+From 0eaed422260125d4d542168630bffe74b2462d5e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 51799b4f971982bc0757cf8a11940eb538b1af57 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 0aa7147b13..b3b55b9035 100644
+index f4858255ce..5a6947615a 100644


More information about the stable mailing list