From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C73CA0351 for ; Thu, 6 Aug 2020 11:59:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 82D141C12A; Thu, 6 Aug 2020 11:59:05 +0200 (CEST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by dpdk.org (Postfix) with ESMTP id 09AC81C123 for ; Thu, 6 Aug 2020 11:59:04 +0200 (CEST) Received: by mail-wr1-f54.google.com with SMTP id a14so43429307wra.5 for ; Thu, 06 Aug 2020 02:59:04 -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=0ImZNPh+JHJQJdkFeb0pk1T2K1rAwLySaBlcA4nreqc=; b=tXGR4S9lOuf40hs7H/Moi5bAN0iudBuIKnCLyksQZFHR2eoicq4XlQqvb7FGZEEGb0 J1CE/b5WI+5boi4OBkEO2yRbZ2MEymzo1SExV8TuISCHm9WgZy/rD5qMPvB6lSbvfyxG Nvy01HZfoOespboln7dZhmW/L3guVoy5ou+lNwN6FlEIBzY4rB0ga6BxRCg0fmlLjFBB 6z7QsoL+4qzkSXRabrB7mjDx3WAjCdumerD4erQts/jnIz6pl+knukLwM+79uQLFszI9 dArnTxcy8UZ0LyIOIB5eK/D863zLiaQuV4fm/X4RGn3/OQeJdThUmOW8qgYtzSIKkzjZ Y7NQ== 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=0ImZNPh+JHJQJdkFeb0pk1T2K1rAwLySaBlcA4nreqc=; b=aKtyh2P1pB9IaLyaJDIFbNGuzUlC9Wsrj1zBoRUdHRENm3PNojGDif855cYK//qIyn y18HO5gmxQEtI25X0STm3D27aHi3DmDVp6+CgDgyqmRzj4w42qw55y7yMsJVDG5URNWj V0ks2911xHxcwd2nIohkF8wofylfgWFMjREi9lq8p10TwV6j7C+RfeWWDr6xHxHwqDQ2 3vOv8KlgxkH7Ymn2Z0fWAFW8LkRY/0KbOwBCWAH55tQ1JXTb8bs68JOGL8geFg+iJdxW XG38ub7KKZg+7iYbKuCoTKjUiXWphjVDMA1GR8z+Zj5gg66WNcevOR43cdZ7X3iCVgi2 727A== X-Gm-Message-State: AOAM530dg4U8Wo0+WUzPrxBNT/LBi/g2B2MhPypXfx2WsaFwdxfpw963 HlAZHaQTkpK4rdBvWRSu8oE= X-Google-Smtp-Source: ABdhPJzqKZ8+r2yRcZWiqc1yZoVdB/NzdF99UpWYu3ak+4EOzWOiUG4sTjUFwYTV54qGZ4YTyu/jNA== X-Received: by 2002:a5d:544f:: with SMTP id w15mr6732022wrv.208.1596707943720; Thu, 06 Aug 2020 02:59:03 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id b129sm5777101wmb.29.2020.08.06.02.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 02:59:03 -0700 (PDT) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Ferruh Yigit , dpdk stable Date: Thu, 6 Aug 2020 10:53:56 +0100 Message-Id: <20200806095411.774624-28-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806095411.774624-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> <20200806095411.774624-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hinic: check memory allocations in flow creation' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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.4 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/08/20. 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. Thanks. Luca Boccassi --- >From 2c6c6d45a3d7926db96f7d19a086375ee9653ccc Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Tue, 28 Jul 2020 20:34:46 +0800 Subject: [PATCH] net/hinic: check memory allocations in flow creation [ upstream commit d7964ce192e79507d3b32b4a02e6293a40eb4708 ] The function rte_zmalloc() could return NULL, the return value need to be checked. Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter") Signed-off-by: Yunjian Wang Reviewed-by: Ferruh Yigit --- drivers/net/hinic/hinic_pmd_flow.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index 49c9d8768..6752a8f15 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c @@ -2112,6 +2112,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, if (!ret) { ntuple_filter_ptr = rte_zmalloc("hinic_ntuple_filter", sizeof(struct hinic_ntuple_filter_ele), 0); + if (ntuple_filter_ptr == NULL) { + PMD_DRV_LOG(ERR, "Failed to allocate ntuple_filter_ptr"); + goto out; + } rte_memcpy(&ntuple_filter_ptr->filter_info, &ntuple_filter, sizeof(struct rte_eth_ntuple_filter)); @@ -2138,6 +2142,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, ethertype_filter_ptr = rte_zmalloc("hinic_ethertype_filter", sizeof(struct hinic_ethertype_filter_ele), 0); + if (ethertype_filter_ptr == NULL) { + PMD_DRV_LOG(ERR, "Failed to allocate ethertype_filter_ptr"); + goto out; + } rte_memcpy(ðertype_filter_ptr->filter_info, ðertype_filter, sizeof(struct rte_eth_ethertype_filter)); @@ -2162,6 +2170,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, if (!ret) { fdir_rule_ptr = rte_zmalloc("hinic_fdir_rule", sizeof(struct hinic_fdir_rule_ele), 0); + if (fdir_rule_ptr == NULL) { + PMD_DRV_LOG(ERR, "Failed to allocate fdir_rule_ptr"); + goto out; + } rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule, sizeof(struct hinic_fdir_rule)); TAILQ_INSERT_TAIL(&nic_dev->filter_fdir_rule_list, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-08-06 10:53:16.893092228 +0100 +++ 0028-net-hinic-check-memory-allocations-in-flow-creation.patch 2020-08-06 10:53:15.812597639 +0100 @@ -1,13 +1,14 @@ -From d7964ce192e79507d3b32b4a02e6293a40eb4708 Mon Sep 17 00:00:00 2001 +From 2c6c6d45a3d7926db96f7d19a086375ee9653ccc Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Tue, 28 Jul 2020 20:34:46 +0800 Subject: [PATCH] net/hinic: check memory allocations in flow creation +[ upstream commit d7964ce192e79507d3b32b4a02e6293a40eb4708 ] + The function rte_zmalloc() could return NULL, the return value need to be checked. Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter") -Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Reviewed-by: Ferruh Yigit @@ -16,10 +17,10 @@ 1 file changed, 12 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c -index a7bad570b..503a32fff 100644 +index 49c9d8768..6752a8f15 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c -@@ -2977,6 +2977,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, +@@ -2112,6 +2112,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, if (!ret) { ntuple_filter_ptr = rte_zmalloc("hinic_ntuple_filter", sizeof(struct hinic_ntuple_filter_ele), 0); @@ -30,7 +31,7 @@ rte_memcpy(&ntuple_filter_ptr->filter_info, &ntuple_filter, sizeof(struct rte_eth_ntuple_filter)); -@@ -3003,6 +3007,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, +@@ -2138,6 +2142,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, ethertype_filter_ptr = rte_zmalloc("hinic_ethertype_filter", sizeof(struct hinic_ethertype_filter_ele), 0); @@ -41,7 +42,7 @@ rte_memcpy(ðertype_filter_ptr->filter_info, ðertype_filter, sizeof(struct rte_eth_ethertype_filter)); -@@ -3036,6 +3044,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, +@@ -2162,6 +2170,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, if (!ret) { fdir_rule_ptr = rte_zmalloc("hinic_fdir_rule", sizeof(struct hinic_fdir_rule_ele), 0);