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 C05FEA0A0C for ; Tue, 3 Aug 2021 14:22:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9761411D7; Tue, 3 Aug 2021 14:22:54 +0200 (CEST) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mails.dpdk.org (Postfix) with ESMTP id 57AF040E3C for ; Tue, 3 Aug 2021 14:22:54 +0200 (CEST) Received: by mail-wr1-f48.google.com with SMTP id k4so14289393wrc.0 for ; Tue, 03 Aug 2021 05:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p/d3zlREfWWaJni0hTSMEgLnsdoVFSwSD4HL1m/6HlY=; b=adwxmyH67qh/RZ9y/PHz8PjoenGhYcAN+qLf8zwjFPdUviDeQePQRzogeRpZDRbDyM d8et1UxiB2jcSnZOBUZySF44TWcT1eGB1QN5ygJe4IVMKk6wNR5xwQxyU8FQ3f6H91tn zAH+biCoeI6XrI6WARJbrmkg8K7dMgsMEsitnB6RNwjTKQf9dn+UciTqrIwoRRIIruFy iXK3G8vWhkwClDTOpiCS9Y6dG/ZfZrAmBCghos8nRlSf1QnEcf4gq9eebxIy59TWsUn8 cqDofejbiLjLLJnJ+0GYATO0KSsGbHRqXP0E33jKcdixpAChcNlE5ODfCjOFOe8m82fO 514A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p/d3zlREfWWaJni0hTSMEgLnsdoVFSwSD4HL1m/6HlY=; b=Xy2kgK1/BhYmOyYnIhpOaZ09AbN4PsdHCsiTiJH47ELw+72gdBX1Fm1tIJcs38vK7u Pzsgmob5gNaJrrJU8TklGvmqZ7y0Drr223HFfPw6bkhDGNG4/kCKs8jcut/RGHtELZ6v 7n0oSnzdH8XDau0IVUGfJnPdBo8ZL/o/c2etIfrkG5/dp6rTsEzwQGhQAlpCI8b5LyxA swzJR7SkMxkRX4oearlOxKze3lKw6dNcVgidaTjdiEszzllQ2GpUdsjxHeWdUo1f0jCG 0R7DGtlcbWwduMe0g0BAJjR2tnrspxpXYA1LI+csw6M3Ur42yfQ+R8g8HSTqr2YZO136 borw== X-Gm-Message-State: AOAM533HrXFCH31GVJzJ5JLcTt1lrsfZNLH0+UzJXEoiGpF3L7URxM48 Mecsa64YMoyw047RQDOOFL8= X-Google-Smtp-Source: ABdhPJzgrsUGunzfGJGm/vghE76gD8PpvBDAHH8UF/9ek3KTZ27g1LOG5+lmDBfMTtSdkuy4MQOutQ== X-Received: by 2002:adf:de87:: with SMTP id w7mr22012589wrl.270.1627993374156; Tue, 03 Aug 2021 05:22:54 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id o17sm8035473wrw.17.2021.08.03.05.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 05:22:53 -0700 (PDT) From: luca.boccassi@gmail.com To: Dapeng Yu Cc: Jasvinder Singh , dpdk stable Date: Tue, 3 Aug 2021 13:22:04 +0100 Message-Id: <20210803122214.1094992-15-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210803122214.1094992-1-luca.boccassi@gmail.com> References: <20210726135322.149850-59-luca.boccassi@gmail.com> <20210803122214.1094992-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/softnic: fix null dereference in arguments parsing' has been queued to stable release 20.11.3 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 Sender: "stable" 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 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 Acked-by: Jasvinder Singh --- 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@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)