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 1E755A034F for ; Wed, 10 Nov 2021 07:42:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18EDA4068B; Wed, 10 Nov 2021 07:42:46 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by mails.dpdk.org (Postfix) with ESMTP id EDEF74068B for ; Wed, 10 Nov 2021 07:42:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VfI13bNRQSRWec50tAtqybsSCPXTV9qRS60DAU7Fo6dkiFtmDX/+ZFx8hEDea8p+wJX40/XWTvyIGQk8DFnraws+0MjLM0hEU+mHHhF1G6ozEPhKAFo0dOhXIc6s9LG3zqprML9u2AeIaZBAUqOJo9FHzRx9MvIBTCjZn4S62rsVOlCnxWOD0igVs4avX8Qu9mDyjfeIzDdcn9JtCNSqVg0LH5fFMYJ6AJpcnrm7XH5WVLZ/m9edSU/LAyrjxvvPoMSoJ6MURoGGROF6UDxOE1wx0arMrGQl3xx0GY/QZOt+Kb8KYtMAFRxN2Ph6P8SIhzlHQY82ohxGNElEve4WPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5H8dvIVVzRbVT4lZCKSS9/srr7vomw/feHdAbJWgYcE=; b=m+q5SJHep2ivejxAY2/G6U9/8qncdy1opIHkOlOwqvM/ZoGff4fpjgP+/XjAlZD4UwyyBnr/Vn7gGYnZA4nOPq+phb0zqmu+2MkPtCYpTnH0jkSx29YQ4Vjuh1+5zOdCR9WSWogrDiGruaZhhaZYZtCJdR9iBGqB387j5XJX4wTxbfF4AZrMgM+uUSSb0EgEPY8c9SK9Fv8eZa1fVjJ7ptNIAjk9ANabyqBwqykGmrG8yBGfL0gIZimsizeT9BdG+ISaM277DKPNaViVjXFR8TzNcOhCdx+3cccXNi+9HMkXWL3VOO8I7GKJ+0OX8uBmlCuCjF+BrJW/u7Grr0DB8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5H8dvIVVzRbVT4lZCKSS9/srr7vomw/feHdAbJWgYcE=; b=ulVVzK92veulJAgZoaoML2HExvvdUyEH0QIYQomiWNQACWZ5bM07YBIV8l4Ng3loSqmh67V7q16/EsTk+u11oozqp0KdIvHHz8Ya777BE25BGpmneExFpk9sWLRGK8+lANVav3blFfTVik/jbcSTXNX7VNSdzp9/V7sJ9I38S5gS3Ptj3LKfV/Q74CpMRH6cDkTeiLBN5i4sDJC5LaUdVsBWnkllFxRENS0RXS8fFndi+jvCNgXpC/L1wSz4o3Uv29MbX37xi350dfGN14HSI2WO1eM5pJOj7XOcMeByDc1ePDAzCUFO4uj4YgsOhXCEZCodzk8TPzM2unb3PtYM0A== Received: from DM6PR06CA0078.namprd06.prod.outlook.com (2603:10b6:5:336::11) by BYAPR12MB2679.namprd12.prod.outlook.com (2603:10b6:a03:72::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 06:42:41 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:336:cafe::d7) by DM6PR06CA0078.outlook.office365.com (2603:10b6:5:336::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 06:42:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:42:38 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:42:35 +0000 From: Xueming Li To: Dapeng Yu CC: Luca Boccassi , Simei Su , dpdk stable Date: Wed, 10 Nov 2021 14:29:37 +0800 Message-ID: <20211110063216.2744012-94-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45e9804e-e48b-4c9c-03db-08d9a4154956 X-MS-TrafficTypeDiagnostic: BYAPR12MB2679: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:138; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bxueOvMu61ualJaTRt+aqdFpPuYSD4MEOAVDMbGPJpJ3P0XHu1yVrmMtVp6oogxvKey8IsO9aF1nCRjoiuFGnoJ5GsjqFdVydTGHL5kb0Cf8wmdK9rgty1MgOcdiVgNKRyUpmsbGpzSyFh2+uU1ucWTwnc5K26WozxdrHwzMJiPAGD0r+28lpKh90ZMNHvQpQ4tP99wjp4Ir9zAHfKCOVEJsb+5zge/4HRgx9yUDIYLfPcfC1U/duQW4HeT2csxSWl04TmONsBVwnftdVrGP8ek1+CAPly/kFgT+6/nd/Lwh3jB+lPMhyNsbGNix8XsQ8koTvL2HA7jZ+K1BLN9Md9+s/ZUKbvfvVxsDFslPDA6JQE9f/5FvqXZyb6Lg/qrwYQtY3gdk1Jtt0tEbr/b1D3coKH4F+2L1uwF4T4sx+ayYE1u176j1yfCKpGSLE0DkzZ5S1OlWdFKcRacN9AwV5KRyg/yJ260uxfvaqu3y7xS4Xjr10N3VRf1wfX5yAO3N1GWMBbbBDM35aP1psBd62tPy0Gq64s/yd1t2TF9Hh86/3XfFEUk9ZHnlmhhPhE0OKVSQ9Tr6raTywLwFy8g33A77I0NLrMmWd9XlaQjg3colAX9yOKtFHaBCDDBWZBJlRjbJ0UJnVYXh5jMqnQ0zcifWnXRWaaoDfUqdQ2Ml14MntlI7cOUs3U8oCZMEwcqq0aApd5QtwbAt+Q92pZ9raUVabUcBz2nXM+Acspr1794MjbRDAISJbutb43XlM0FmqksSD6DW+uYpj1L2VNTucIyagLDvd/IdOaESogBjYIBzVGlPFgz5fVFPhELhBS1+vn42UNqxfOgnCZbZxsCSIA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(1076003)(83380400001)(36756003)(26005)(16526019)(426003)(356005)(336012)(2616005)(4326008)(36860700001)(82310400003)(7636003)(4001150100001)(53546011)(8676002)(186003)(7696005)(70586007)(508600001)(54906003)(70206006)(966005)(55016002)(2906002)(6286002)(316002)(86362001)(47076005)(5660300002)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:42:38.0058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45e9804e-e48b-4c9c-03db-08d9a4154956 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2679 Subject: [dpdk-stable] patch 'net/ice: fix double free ACL flow entry' has been queued to stable release 20.11.4 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.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 11/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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/cd90c7a5b2ed9bb585579e387b6832c219ccb1da Thanks. Xueming Li --- >From cd90c7a5b2ed9bb585579e387b6832c219ccb1da Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Fri, 3 Sep 2021 18:04:11 +0800 Subject: [PATCH] net/ice: fix double free ACL flow entry Cc: Xueming Li [ upstream commit e360df56477a0b5963a743d82f399efd468ec10c ] If call ice_flow_rem_entry() directly without checking entry_id, may cause an ACL flow entry to be freed more than once. This patch tries to find entry_id first, then call ice_flow_rem_entry() to avoid the defect. Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF") Signed-off-by: Dapeng Yu Reviewed-by: Simei Su --- drivers/net/ice/ice_acl_filter.c | 33 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c index 95b235e470..7e44751d64 100644 --- a/drivers/net/ice/ice_acl_filter.c +++ b/drivers/net/ice/ice_acl_filter.c @@ -45,7 +45,7 @@ static struct ice_flow_parser ice_acl_parser; struct acl_rule { enum ice_fltr_ptype flow_type; - uint32_t entry_id[4]; + uint64_t entry_id[4]; }; static struct @@ -440,7 +440,7 @@ ice_acl_hw_set_conf(struct ice_pf *pf, struct ice_fdir_fltr *input, PMD_DRV_LOG(ERR, "Fail to add entry."); return ret; } - rule->entry_id[entry_idx] = slot_id; + rule->entry_id[entry_idx] = entry_id; pf->acl.hw_entry_id[slot_id] = hw_entry; } else { PMD_DRV_LOG(ERR, "Exceed the maximum entry number(%d)" @@ -451,18 +451,28 @@ ice_acl_hw_set_conf(struct ice_pf *pf, struct ice_fdir_fltr *input, return 0; } +static inline void +ice_acl_del_entry(struct ice_hw *hw, uint64_t entry_id) +{ + uint64_t hw_entry; + + hw_entry = ice_flow_find_entry(hw, ICE_BLK_ACL, entry_id); + ice_flow_rem_entry(hw, ICE_BLK_ACL, hw_entry); +} + static inline void ice_acl_hw_rem_conf(struct ice_pf *pf, struct acl_rule *rule, int32_t entry_idx) { uint32_t slot_id; int32_t i; + uint64_t entry_id; struct ice_hw *hw = ICE_PF_TO_HW(pf); for (i = 0; i < entry_idx; i++) { - slot_id = rule->entry_id[i]; + entry_id = rule->entry_id[i]; + slot_id = ICE_LO_DWORD(entry_id); rte_bitmap_set(pf->acl.slots, slot_id); - ice_flow_rem_entry(hw, ICE_BLK_ACL, - pf->acl.hw_entry_id[slot_id]); + ice_acl_del_entry(hw, entry_id); } } @@ -562,6 +572,7 @@ ice_acl_destroy_filter(struct ice_adapter *ad, { struct acl_rule *rule = (struct acl_rule *)flow->rule; uint32_t slot_id, i; + uint64_t entry_id; struct ice_pf *pf = &ad->pf; struct ice_hw *hw = ICE_PF_TO_HW(pf); int ret = 0; @@ -569,19 +580,19 @@ ice_acl_destroy_filter(struct ice_adapter *ad, switch (rule->flow_type) { case ICE_FLTR_PTYPE_NONF_IPV4_OTHER: for (i = 0; i < 4; i++) { - slot_id = rule->entry_id[i]; + entry_id = rule->entry_id[i]; + slot_id = ICE_LO_DWORD(entry_id); rte_bitmap_set(pf->acl.slots, slot_id); - ice_flow_rem_entry(hw, ICE_BLK_ACL, - pf->acl.hw_entry_id[slot_id]); + ice_acl_del_entry(hw, entry_id); } break; case ICE_FLTR_PTYPE_NONF_IPV4_UDP: case ICE_FLTR_PTYPE_NONF_IPV4_TCP: case ICE_FLTR_PTYPE_NONF_IPV4_SCTP: - slot_id = rule->entry_id[0]; + entry_id = rule->entry_id[0]; + slot_id = ICE_LO_DWORD(entry_id); rte_bitmap_set(pf->acl.slots, slot_id); - ice_flow_rem_entry(hw, ICE_BLK_ACL, - pf->acl.hw_entry_id[slot_id]); + ice_acl_del_entry(hw, entry_id); break; default: rte_flow_error_set(error, EINVAL, -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:06.158587552 +0800 +++ 0093-net-ice-fix-double-free-ACL-flow-entry.patch 2021-11-10 14:17:01.850746254 +0800 @@ -1 +1 @@ -From e360df56477a0b5963a743d82f399efd468ec10c Mon Sep 17 00:00:00 2001 +From cd90c7a5b2ed9bb585579e387b6832c219ccb1da Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit e360df56477a0b5963a743d82f399efd468ec10c ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index 614bd44e23..8fe6f5aeb0 100644 +index 95b235e470..7e44751d64 100644