From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28F0743BA7 for ; Tue, 5 Mar 2024 16:35:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 222CC42D72; Tue, 5 Mar 2024 16:35:18 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 5B576402A8 for ; Tue, 5 Mar 2024 16:35:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709652916; 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=0pw3bJnZBOeALg2J7yuZKx7HmJwAYbvi0gGWCnmGxwQ=; b=jPkGGsQ/n5O4cIMwKSYOAUJsHh8hSMv12wqnX8R3W1aPTflFuHzPID9U8FZTqyGyXR1uqV ReUDTMKbAnkWYGZP1IBm7WQUH8tPp0FNQPWd3q/GOWRH86ctYf9goVne2A27bHtke2C32T 4NJVAtwWuGhXLt90PgcAmdwqN5QXq7U= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-1y9_Gp5bPkqqdE5mNnNU_w-1; Tue, 05 Mar 2024 10:35:13 -0500 X-MC-Unique: 1y9_Gp5bPkqqdE5mNnNU_w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 832733C025C3; Tue, 5 Mar 2024 15:35:13 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id E32662022EDB; Tue, 5 Mar 2024 15:35:12 +0000 (UTC) From: Kevin Traynor To: Chengwen Feng Cc: dpdk stable Subject: patch 'eal: verify strdup return' has been queued to stable release 21.11.7 Date: Tue, 5 Mar 2024 15:33:44 +0000 Message-ID: <20240305153449.263666-11-ktraynor@redhat.com> In-Reply-To: <20240305153449.263666-1-ktraynor@redhat.com> References: <20240305153449.263666-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.7 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/11/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/7fc3309c5d8719c2141305797b74d8a5b738438c Thanks. Kevin --- >From 7fc3309c5d8719c2141305797b74d8a5b738438c Mon Sep 17 00:00:00 2001 From: Chengwen Feng 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 --- 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 1cfdd75f3b..1cd7a33fbf 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -227,4 +227,6 @@ eal_save_args(int argc, char **argv) break; eal_args[i] = strdup(argv[i]); + if (eal_args[i] == NULL) + goto error; } eal_args[i++] = NULL; /* always finish with NULL */ @@ -236,11 +238,29 @@ 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 52fe336572..28a8ddc18c 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -186,4 +186,6 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) strlcpy(pci_slot_name, buf, sizeof(subsystem)); event->devname = strdup(pci_slot_name); + if (event->devname == NULL) + return -1; } for (; i < length; i++) { -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 14:08:55.001873193 +0000 +++ 0011-eal-verify-strdup-return.patch 2024-03-05 14:08:54.622520691 +0000 @@ -1 +1 @@ -From 5821a384a4ca611e0f67786400b9f5b18f34a416 Mon Sep 17 00:00:00 2001 +From 7fc3309c5d8719c2141305797b74d8a5b738438c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5821a384a4ca611e0f67786400b9f5b18f34a416 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index d9748076b4..e541f07939 100644 +index 1cfdd75f3b..1cd7a33fbf 100644 @@ -62 +63 @@ -index e678dce6c7..fff4e8fa83 100644 +index 52fe336572..28a8ddc18c 100644 @@ -65 +66 @@ -@@ -183,4 +183,6 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) +@@ -186,4 +186,6 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)