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 9C90343D20 for ; Fri, 22 Mar 2024 11:02:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D0DD402CB; Fri, 22 Mar 2024 11:02:37 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by mails.dpdk.org (Postfix) with ESMTP id AF11C4003C; Fri, 22 Mar 2024 11:02:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5aEKdY1OkByHkTtMpkqfEcNFA3MWJn95GDV96J8nIMXkcdYI2XNHXKzmpi9lSRAAs21CSIJB06OWGK2n62CqhlxULg1sAeROwmYRJ6/VT2gpiNSG4Wid5T7Z/AuAH1wkWKsxlQJXpWa5fUUNyiVTCRc2USZAkWK6zi5IXVa48OhjDtJhl9XlUzbFUPK/BnE19OrJ9Ct7WlI2u5T7zMMzkeE0/ORFx2BQm97EPe1oB04SHBTEpxHru6rJ18cpXEr2N9Wg5wfq1HXh7rHEHrMMC/zgzkUZQYDRa6Iho7KwYiNH6XvWhbzNfjgC/kxsGj79D+/DWsHHEViHPsyAFYAUQ== 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=+XaJN0S77ycCANAtz4vRHPTZLsQpelPMiAA9WhpeZgM=; b=doq03yhuMT8uMCwlu2aNVUIOlOYupr6GzNEWvtZ5Q62y8dU7rPBr6cZKZ3vkDYFltCgKWJQ0RsLkjaCC4HBnvpEctftNxc5NLLrtSMKXyQZwJcgPPJmFsDUSgpI5wb2zhANBBy0KSevuw6iYNvdrWEsv+92eoo1cG5ppFEr8wqw73+0MmMM7DyWX0KfgbUmc9cAx6UlZO6Ju9M6BRYdHLaTTq0iw+HN1fbSZUykajSvhd2Ur6efxjEZkbaw1blzeQ/ct7mXtS50biev/7PlsGDsZQYeZcGr8xjycDoeroR0rjUOFePLc6FVvyEmW+jH8Ih0C71P2u20AcM7KkNVOZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=+XaJN0S77ycCANAtz4vRHPTZLsQpelPMiAA9WhpeZgM=; b=HC27RDdHhc8hLT9qF21Aqfqo/WjrF6gclyQ77GbBJ0KCbudiDGIoYAliaYqnR9AssvRHYMVue61a+VTI0tm2+ecDN2zPZ1LNHGjnLzGXHbjmKB/mXbuPgZpBSV7PDzToibQcl4k7vLC1ch8zqof8ndQSs5fHb/j2CtGkMVghywZsCWMU5bLrU9WO6gjUhaMa3Odl8e8Uw/JrEF5/UYplLlUO8S7Qm/andwfLdyn/rBI+B32zOQxUBGRdDXR+iod8+LCCz/hT26prxjzehwoqdYBHA6YQOmIYHiRyL6sR9nZpQHjXKavFim6SNlukHJitEPoZRn+k/J5flJqBOavpMw== Received: from MN2PR13CA0010.namprd13.prod.outlook.com (2603:10b6:208:160::23) by IA0PR12MB7506.namprd12.prod.outlook.com (2603:10b6:208:442::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Fri, 22 Mar 2024 10:02:34 +0000 Received: from BL02EPF0001A0FE.namprd03.prod.outlook.com (2603:10b6:208:160:cafe::91) by MN2PR13CA0010.outlook.office365.com (2603:10b6:208:160::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.12 via Frontend Transport; Fri, 22 Mar 2024 10:02:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0001A0FE.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Fri, 22 Mar 2024 10:02:33 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 22 Mar 2024 03:02:18 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Fri, 22 Mar 2024 03:02:14 -0700 From: Gregory Etelson To: CC: , , , , , Dariusz Sosnowski , Viacheslav Ovsiienko , "Ori Kam" , Suanming Mou , Matan Azrad , Erez Shitrit Subject: [PATCH] net/mlx5/hws: fix invalid memory access in decapl3 Date: Fri, 22 Mar 2024 12:01:59 +0200 Message-ID: <20240322100159.575712-1-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail202.nvidia.com (10.129.68.7) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A0FE:EE_|IA0PR12MB7506:EE_ X-MS-Office365-Filtering-Correlation-Id: dbd1381d-a8d7-4062-1f1d-08dc4a5731e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nOk8ZChm22f/NKNFXjYLMNYYfde+bdxc1Uu6JoxR4Q84nlVaLbOI+KqR3nUnjzd+fGLB7IoAmaHu04kt+fgVbNOP5EcC0w3fdt6J2/JO4pF4d8Gu4LqEVc8KHKroamvX30MPmhDbRg4SPrlrMUTyO7MQfsn3f7JAaYuqzVQn50K2jX5pEsRhLErxMQ8wIfycVms9iPGeDXgAhn24PAzqLb2QvV/PUnu0+qJKQRT3irZsMZhs9XYycFuzR6N9GKxucCMbqwrJUwMIhUEJidtS+tdjS6U1Z+M0sCJDZQzakcACu8vbPFCTcGEVsLSnCUaOS0Ozke/rUu938rx1BV+5DSyEDfGtwOnSpIYV7dICjPioAKoALCaRD1SBHX+zq2jQV5XOua7e5kEZOSrK+cK3Pc8avZNE8gOz1YRKQDml1whPDM2/xyNmRWqcGTns94T1BaOIWtAOmxlPbSBoMcTv8R2SK6ekvozZx/CcZ2WCbaqrlioYwPoL6y1KnaRybxj89spNL8MsAnUra45d1m1BDuefB0O7u/uO2+LiWT8AhQuc1najTAfJhqswUlyJR5AS+RZjeuWb/W+GrdCi88RnpSQ88PVHe401/J913io4fPE0KWLWizlTTRzbYwF03gpAFnQ8zioh9UAy7i85rOqHQPyYVck4mRrEE4gvtyLk28PkT5IgxJGBSYwe80T3vQM9eiNqaoszunaltkQ/8oW6C74WC2yAr+679jjrgAaPkhvmdSViKXw3XLWq1Q96T6/g X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(36860700004)(82310400014)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 10:02:33.7249 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbd1381d-a8d7-4062-1f1d-08dc4a5731e2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A0FE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7506 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 From: Alex Vesker In case decapL3 action is created we would access header data even in case the SHARED flag is not set, this would lead to an invalid memory access. Fixes: 3a6c50215c07 ("net/mlx5/hws: support multi-pattern") Cc: stable@dpdk.org Signed-off-by: Alex Vesker --- drivers/net/mlx5/hws/mlx5dr_action.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 084d4d606e..562fb5cbb4 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -1775,7 +1775,9 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action, /* Create a full modify header action list in case shared */ mlx5dr_action_prepare_decap_l3_actions(hdrs->sz, mh_data, &num_of_actions); - mlx5dr_action_prepare_decap_l3_data(hdrs->data, mh_data, num_of_actions); + + if (action->flags & MLX5DR_ACTION_FLAG_SHARED) + mlx5dr_action_prepare_decap_l3_data(hdrs->data, mh_data, num_of_actions); /* All DecapL3 cases require the same max arg size */ arg_obj = mlx5dr_arg_create_modify_header_arg(ctx, -- 2.39.2