patch 'eal: verify strdup return' has been queued to stable release 22.11.5
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Mar 7 02:30:38 CET 2024
Hi,
FYI, your patch has been queued to stable release 22.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/09/24. 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/10d9146d6d3a777e510633cbd31f4c94aa7a685e
Thanks.
Luca Boccassi
---
>From 10d9146d6d3a777e510633cbd31f4c94aa7a685e Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen at huawei.com>
Date: Fri, 10 Nov 2023 10:01:02 +0000
Subject: [PATCH] eal: verify strdup return
[ upstream commit 5821a384a4ca611e0f67786400b9f5b18f34a416 ]
Add verify strdup() return value logic.
Fixes: 293c53d8b23c ("eal: add telemetry callbacks")
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
lib/eal/common/eal_common_options.c | 24 ++++++++++++++++++++++--
lib/eal/linux/eal_dev.c | 2 ++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index 43b16805da..18a50f7452 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -225,6 +225,8 @@ eal_save_args(int argc, char **argv)
if (strcmp(argv[i], "--") == 0)
break;
eal_args[i] = strdup(argv[i]);
+ if (eal_args[i] == NULL)
+ goto error;
}
eal_args[i++] = NULL; /* always finish with NULL */
@@ -234,13 +236,31 @@ eal_save_args(int argc, char **argv)
eal_app_args = calloc(argc - i + 1, sizeof(*eal_args));
if (eal_app_args == NULL)
- return -1;
+ goto error;
- for (j = 0; i < argc; j++, i++)
+ for (j = 0; i < argc; j++, i++) {
eal_app_args[j] = strdup(argv[i]);
+ if (eal_app_args[j] == NULL)
+ goto error;
+ }
eal_app_args[j] = NULL;
return 0;
+
+error:
+ if (eal_app_args != NULL) {
+ i = 0;
+ while (eal_app_args[i] != NULL)
+ free(eal_app_args[i++]);
+ free(eal_app_args);
+ eal_app_args = NULL;
+ }
+ i = 0;
+ while (eal_args[i] != NULL)
+ free(eal_args[i++]);
+ free(eal_args);
+ eal_args = NULL;
+ return -1;
}
#endif
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ac76f6174d..c0ba98852b 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -182,6 +182,8 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
i += 14;
strlcpy(pci_slot_name, buf, sizeof(subsystem));
event->devname = strdup(pci_slot_name);
+ if (event->devname == NULL)
+ return -1;
}
for (; i < length; i++) {
if (*buf == '\0')
--
2.39.2
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-03-07 01:05:36.812377810 +0000
+++ 0021-eal-verify-strdup-return.patch 2024-03-07 01:05:34.702937979 +0000
@@ -1 +1 @@
-From 5821a384a4ca611e0f67786400b9f5b18f34a416 Mon Sep 17 00:00:00 2001
+From 10d9146d6d3a777e510633cbd31f4c94aa7a685e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5821a384a4ca611e0f67786400b9f5b18f34a416 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -19 +20 @@
-index d9748076b4..e541f07939 100644
+index 43b16805da..18a50f7452 100644
@@ -22 +23 @@
-@@ -226,6 +226,8 @@ eal_save_args(int argc, char **argv)
+@@ -225,6 +225,8 @@ eal_save_args(int argc, char **argv)
@@ -31 +32 @@
-@@ -235,13 +237,31 @@ eal_save_args(int argc, char **argv)
+@@ -234,13 +236,31 @@ eal_save_args(int argc, char **argv)
@@ -66 +67 @@
-index e678dce6c7..fff4e8fa83 100644
+index ac76f6174d..c0ba98852b 100644
More information about the stable
mailing list