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 B0F4DA04E7 for ; Wed, 4 Nov 2020 09:36:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A9FDDC7FC; Wed, 4 Nov 2020 09:36:42 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id F3145C7FC for ; Wed, 4 Nov 2020 09:36:39 +0100 (CET) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CR0PF39hrzkXcL; Wed, 4 Nov 2020 16:36:33 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Wed, 4 Nov 2020 16:36:28 +0800 From: Xiaoyun wang To: CC: , , , , Xiaoyun wang Date: Wed, 4 Nov 2020 16:40:04 +0800 Message-ID: <57e0ebeab5527f8f936e9511eff88d85c1e0ac99.1604478636.git.cloud.wangxiaoyun@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-stable] [PATCH 19.11 v1 1/1] net/hinic: fix filters on memory allocation failure 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" [ upstream commit 0c87a15f5f1ccb9eefb6231aea9d095686f2def4 ] If rte_zmalloc failed, pmd driver should also delete the ntuple filter or ethertype filter or normal and tcam filter that already added before. Fixes: d7964ce192e7 ("net/hinic: check memory allocations in flow creation") Signed-off-by: Xiaoyun wang --- drivers/net/hinic/hinic_pmd_flow.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index 7bbdcc9..f820be4 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c @@ -683,6 +683,7 @@ static int hinic_ntuple_item_check_end(const struct rte_flow_item *item, item, "Not supported by ntuple filter"); return -rte_errno; } + return 0; } @@ -2116,6 +2117,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, sizeof(struct hinic_ntuple_filter_ele), 0); if (ntuple_filter_ptr == NULL) { PMD_DRV_LOG(ERR, "Failed to allocate ntuple_filter_ptr"); + (void)hinic_add_del_ntuple_filter(dev, + &ntuple_filter, FALSE); goto out; } rte_memcpy(&ntuple_filter_ptr->filter_info, @@ -2146,6 +2149,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, sizeof(struct hinic_ethertype_filter_ele), 0); if (ethertype_filter_ptr == NULL) { PMD_DRV_LOG(ERR, "Failed to allocate ethertype_filter_ptr"); + (void)hinic_add_del_ethertype_filter(dev, + ðertype_filter, FALSE); goto out; } rte_memcpy(ðertype_filter_ptr->filter_info, @@ -2174,6 +2179,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, sizeof(struct hinic_fdir_rule_ele), 0); if (fdir_rule_ptr == NULL) { PMD_DRV_LOG(ERR, "Failed to allocate fdir_rule_ptr"); + hinic_add_del_fdir_filter(dev, + &fdir_rule, FALSE); goto out; } rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule, -- 1.8.3.1