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 955F6A0C47 for ; Tue, 10 Aug 2021 17:45:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C3B44014F; Tue, 10 Aug 2021 17:45:28 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by mails.dpdk.org (Postfix) with ESMTP id 36FBD4014F for ; Tue, 10 Aug 2021 17:45:27 +0200 (CEST) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (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 smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 1F46E3F107 for ; Tue, 10 Aug 2021 15:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610327; bh=x6/p0879su1XSlVfwC//W0m0nDobbtTWXdKjz7s9qhc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CEv2aNtxUIUSfiVA5QHzsiNDB/UAMXG8u64vxwl5Da1K2B3MwTo6KWdcKWz2R0Mha Sr50BEo98CQzCiyYdIFWWck+ut3bASkfgaFuqo0bGug/4T2wYmGdb8oLdtkrBqNrJS wDvx3HgEkzOXaxO7X726+JEBxFozbRIxs0bu9LBg8gPqwPPLGuLHsDCEFhgZ9J4CvM MVHvSVYhz/g8h0EjN2egNb8b7rDwLedS90TX9isI162qYVe55sW1+54o4rQ3WhfDQU pO0aBiL64/sbBfdSnYaA7hMqAWTFJE0HVyZIynyDauElwZwhpvMPb6vmQJMs1IFpPV njTBM/EBk3hUA== Received: by mail-ed1-f70.google.com with SMTP id b16-20020a0564022790b02903be6352006cso3753148ede.15 for ; Tue, 10 Aug 2021 08:45:27 -0700 (PDT) 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=x6/p0879su1XSlVfwC//W0m0nDobbtTWXdKjz7s9qhc=; b=eun8umBtcLC2thLxgq80FIy1M13rvvXp1UrYfqKZW1d2J8vpUDjQTQ9DGpPQUvKr4x KwAtTo4EU0YsA7/Kes6R5SL5geo5TPDAOWQJz201Yv2gfqQe/zB0qNVIpHuPQb9qlR0v FHCpzx2tHVawJD/9UV2fqBKnQizcCSAO1RGgUMe/+NEZzf5Rcic24GPxKXvRtt3R+jLb 7guc9yYXlNnJ9VV97dsXXQu838oxfdtgfAGwxnadAN+AUhdKTR9Q6FDwr1Z0FLbVvyXI z7v1FHnvXLofnDHogsvyt/eXv0xye/oRIxIO2cLeIxEI2eqxImyE2GqrlijLbSHYkbCM EFNA== X-Gm-Message-State: AOAM533RUl0o/tFRWY6KBa2Yo9BTvoCIZ2OmMkXfcpKN4kk770b8wu5a KRUs9zaTsRzk9JCYsilhx2Ub2H5LotN2adCTOxskBAPCB+GLZf0fBLDolX16mMtxrpSkNxim6py wWUYMbTm+mhGYMGW0FqAoIMz9 X-Received: by 2002:a17:906:a195:: with SMTP id s21mr28231309ejy.181.1628610326801; Tue, 10 Aug 2021 08:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMkDhO3kv99xglZqZqjDEtlVIUXTDLy45AWZhpjndIPzHKjRDjtsUAm0SZ4I3N43Qtq5Lpbg== X-Received: by 2002:a17:906:a195:: with SMTP id s21mr28231287ejy.181.1628610326626; Tue, 10 Aug 2021 08:45:26 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id w20sm317783edu.22.2021.08.10.08.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:45:26 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Dapeng Yu Cc: Jasvinder Singh , dpdk stable Date: Tue, 10 Aug 2021 17:40:16 +0200 Message-Id: <20210810154022.749358-96-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.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 19.11.10 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 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 --- >From 0eaed422260125d4d542168630bffe74b2462d5e 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 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@dpdk.org @@ -24 +25 @@ -index 0aa7147b13..b3b55b9035 100644 +index f4858255ce..5a6947615a 100644