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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Aug 3 14:22:04 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.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 08/05/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/c3e2390817b0431a9aae14b3412fe87f37dcb18b

Thanks.

Luca Boccassi

---
>From c3e2390817b0431a9aae14b3412fe87f37dcb18b 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 ceed6bf96d..0ac3c0b0ec 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -486,17 +486,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.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-08-03 12:35:08.840442871 +0100
+++ 0015-net-softnic-fix-null-dereference-in-arguments-parsin.patch	2021-08-03 12:35:08.238819208 +0100
@@ -1 +1 @@
-From 51799b4f971982bc0757cf8a11940eb538b1af57 Mon Sep 17 00:00:00 2001
+From c3e2390817b0431a9aae14b3412fe87f37dcb18b 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 ceed6bf96d..0ac3c0b0ec 100644
@@ -27 +28 @@
-@@ -479,17 +479,19 @@ pmd_parse_args(struct pmd_params *p, const char *params)
+@@ -486,17 +486,19 @@ pmd_parse_args(struct pmd_params *p, const char *params)


More information about the stable mailing list