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 5BACF45CE3 for ; Mon, 11 Nov 2024 07:36:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52D1D40685; Mon, 11 Nov 2024 07:36:16 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2068.outbound.protection.outlook.com [40.107.101.68]) by mails.dpdk.org (Postfix) with ESMTP id CA09540E1E for ; Mon, 11 Nov 2024 07:36:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=roLkRloKy6uXrCU1ErxsylFag2R9rpjWlQKm00z1waXhjZapy0nE8UvSsNOQOlqt2dgkIIsSaveBp6UFpmlMq/sxW31h+fjs3q8o1f8tP5WSFt/LsCvYqksJ83X7zKZi5EeuEwEsRymMvq99W79zjlA4mUaiVJT6IQGBzZRN7BrifBXH+z4mu/VhHU9Yl85jNt4L9w6/pg0HDErcv9+DFasNri0lhIZ7PRFw2VeoOY0J7Ibnu+hQRLnrvaKk/VQUDHPhpTztCwlm2ZRBoBiTrLIz+WxnWA7WEXxbE2bBN13e+NKSO69DqUxRYTb52ENc531SfF1L8uZnaV/EE6g5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7sztALCnuYDOK3q0is4kIQKvrYLnGMz+cteG0kbv1kc=; b=QNulgHUrHGfatrNInJHkdEnwK9svKBljY2pHWGKY8qiARMLFVTWkTlR6ufE/3/75FMugxDXue/2CdVvy6sAtbF0ycMSWn9DhDr4RYq1FYXCDCR9V3IjSSx61+A642J0fBUtEX4+9Hk7Aw611NlLHBd91u8Ty0SeJm1UCyuvrsAnI5Mq0Bpce3uQArUbih4+QppAji0uouLsis9KhrUrniaixViRP/RSL3VO+PKtT5leBvHASKUXUkDgN1gmlLsp6NhXEHbOxxISb0mOlZRIIXCrEoudJeOcqbfUVw2FcKyAhXjfqtZRuL3KoPL+Dx3M9c5xYdZlIUKtLSg8/6Wsxyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=7sztALCnuYDOK3q0is4kIQKvrYLnGMz+cteG0kbv1kc=; b=tVR6aTppTdGBayZMihJE6n0MW2jHXvL7YUXEwXhv0fsq3XmUvMpamTMQmZxDNr9RmwsVEvmLvvhd1joAUy22OtolTkrY4xyNgBQCRQ4WUsMk+8EhsBgg+PldfAnzipoEPLaCmie/HObhgOFmtC8BqVKH8q1PwXDQlobFWqjzHzy4XF+JRbNzWm+kaXuc/ZcYOK6H7MtDr5lLIFCHyZgI10wysUd2hpqzQL8kjpsvyemh+WS7autLtN8N4rlv3pVfi/uAPAEuodqPKoSNjalEMjAmf9Bc2nI6+O6Ojx5yM2hvuGEnn0E88jRk0PhKOdXuHHP3ewIZT7r71GQqFdPi0Q== Received: from BN9PR03CA0951.namprd03.prod.outlook.com (2603:10b6:408:108::26) by PH8PR12MB6985.namprd12.prod.outlook.com (2603:10b6:510:1bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.27; Mon, 11 Nov 2024 06:36:11 +0000 Received: from BN2PEPF000044A8.namprd04.prod.outlook.com (2603:10b6:408:108:cafe::9d) by BN9PR03CA0951.outlook.office365.com (2603:10b6:408:108::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.26 via Frontend Transport; Mon, 11 Nov 2024 06:36:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN2PEPF000044A8.mail.protection.outlook.com (10.167.243.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 11 Nov 2024 06:36:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:35:54 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:35:51 -0800 From: Xueming Li To: Barbara Skobiej CC: , Anatoly Burakov , "Bruce Richardson" , dpdk stable Subject: patch 'net/i40e/base: fix loop bounds' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:27:53 +0800 Message-ID: <20241111062847.216344-68-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A8:EE_|PH8PR12MB6985:EE_ X-MS-Office365-Filtering-Correlation-Id: 34cb4a6c-f85a-45ac-15c9-08dd021b21c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5loqR2DtevvuMc8cmHXPMTdEHZCu6Ow63ErhOGS1A3SC2qbEdNcV9+aPyzAI?= =?us-ascii?Q?ANbCBdMPC7MkHVikCgaRG7PhgkzGnyu+zEycPbTa37eiKDXvdFldpxwJWNg0?= =?us-ascii?Q?OkYXEJwTinGA61ga+tMCnpCMjYePwGSg/IWAovVcq8R0sjOxTU9DRBtIpAHH?= =?us-ascii?Q?I+qSQ/m6ZtJxKa4lwOk0XtQzpoYGGlgHV/70QfGoVRWdzbgsYyPU6b3/4KZW?= =?us-ascii?Q?WMVcWYsVMUjIWk+NtmIkhUm45DYHK7eZjbHwfcGwQjDGGL5JqIiqspGHcrtl?= =?us-ascii?Q?j2wjSL1+vQ/2tVrDzc3OAtxGw/kr1stIQ0NU3JcZPlCPcRbBmsNnGL4F+Shl?= =?us-ascii?Q?Tnufwd64xk105K+al1tOGeLDQevrvvwbo9gyirj6paap+6pINe++1rskEQni?= =?us-ascii?Q?1J/QAMBLRCCaxeaKhr/fW3cS94yFKpnHiaGd8kfEvvD+STUTkRRPfTwIPYSo?= =?us-ascii?Q?8VehqrJAqQfRVD6Ulzvtax1E5YrNBKvGoAcPKAaHIEmlzv91DJBHIUel/PmR?= =?us-ascii?Q?4cAGz2tP7ce9/wj4jcccsESAsFUv+XsFdQjJ5tmFQjpdXijLXz5/Q5MXgIfj?= =?us-ascii?Q?NNrDCBAsc8RzA48Yclbpnp58ECA8U4deXmp1Rbg5rQwhaVHef0xQGZA60gsR?= =?us-ascii?Q?t9ZA8PIF1beBlRtWZwNOEVJr5w5+ylgVhF1yg3fRPY2sRbpBwh2zJJhRCuDV?= =?us-ascii?Q?B7zSyameyH6J7T3Us+5vQJJ1pAkykpg3iGQsc4bbUglHo+mkpPFe2sgFgiZQ?= =?us-ascii?Q?VU8+JDsMieH3p6epXQWYJKzWe8uQ1nzLsoyHEdZwG4WKlAZIuC87e68gifzQ?= =?us-ascii?Q?YDVhA0Pv60DulrOlJFBHuIlKVBXdlt/9hjiNkw0l8RmTHdhR+QkdWwLoBufI?= =?us-ascii?Q?xjZ1LlKroFTLZZe9PCsDhvltwaZYf+6T+lvuebtg79ZxM1lzRFsYVCLmzeQY?= =?us-ascii?Q?iFvzTGzqjLBGuE9UGCFNhaF1Lhw0KKwcOEO7wYP/LoaXmQgNX+WZscQ+fLBc?= =?us-ascii?Q?FBNBszG3zjWbHbKg+yRspTQMa2ZL6KJ069RfXq/lV6Hp2JcjVUa+gREAVVqe?= =?us-ascii?Q?IegJ/zVLwHZMQ1NEmp3gc0ET23xAao6F0hrLEgwIkCwbF8+tfMZ4x4barzkr?= =?us-ascii?Q?cr2NfOVi/pf6ScKAS5Mbmk3TKEC49MY3U0rG/gFU9IQKTSMGHfxdZrI9ahsI?= =?us-ascii?Q?H0LRBjKKOiHKktH57AniEZZb8JgnFDmVXyn876pQyC+AKtV/0lBnFdJbbQBL?= =?us-ascii?Q?KXTgdTBfmX1ji45kxunaFN+savrYC5km6B2Zbt08UzTVXLS9qED7rZygANGV?= =?us-ascii?Q?hQuSsoY6qLnKt2M2tJkMgDuZLGVwPelkf3DVdy7jfR+kpzERXj17jZO65Oxt?= =?us-ascii?Q?odHSXivAoslypa7uxliyfBz/SkvECdCBXxe9+Ns4hVM6prKwmA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:36:10.8646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34cb4a6c-f85a-45ac-15c9-08dd021b21c9 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000044A8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6985 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 Hi, FYI, your patch has been queued to stable release 23.11.3 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/30/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=453f75257c416c6fd10b2011fcd463275e017ab4 Thanks. Xueming Li --- >From 453f75257c416c6fd10b2011fcd463275e017ab4 Mon Sep 17 00:00:00 2001 From: Barbara Skobiej Date: Mon, 2 Sep 2024 10:54:35 +0100 Subject: [PATCH] net/i40e/base: fix loop bounds Cc: Xueming Li [ upstream commit 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 ] An unchecked value used as a loop bound. Add verification if value of 'next_to_clean' variable is greater than 2^10 (next_to_clean is 10 bits). Also, refactored loop so that it reads the head value only once, and also checks if head is invalid. Fixes: 8db9e2a1b232 ("i40e: base driver") Signed-off-by: Barbara Skobiej Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- drivers/net/i40e/base/i40e_adminq.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c index 27c82d9b44..cd3b0f2e45 100644 --- a/drivers/net/i40e/base/i40e_adminq.c +++ b/drivers/net/i40e/base/i40e_adminq.c @@ -791,12 +791,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) u16 ntc = asq->next_to_clean; struct i40e_aq_desc desc_cb; struct i40e_aq_desc *desc; + u32 head = 0; + + if (ntc >= (1 << 10)) + goto clean_asq_exit; desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); - while (rd32(hw, hw->aq.asq.head) != ntc) { + while (true) { + head = rd32(hw, hw->aq.asq.head); + + if (head >= asq->count) { + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "Read head value is improper\n"); + return 0; + } + + if (head == ntc) + break; + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, - "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head)); + "ntc %d head %d.\n", ntc, head); if (details->callback) { I40E_ADMINQ_CALLBACK cb_func = @@ -816,6 +830,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) asq->next_to_clean = ntc; +clean_asq_exit: return I40E_DESC_UNUSED(asq); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:08.369502474 +0800 +++ 0067-net-i40e-base-fix-loop-bounds.patch 2024-11-11 14:23:05.172192839 +0800 @@ -1 +1 @@ -From 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 Mon Sep 17 00:00:00 2001 +From 453f75257c416c6fd10b2011fcd463275e017ab4 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3e61fe48412f46daa66f7ccc8f03b1e7620d0b64 ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +25 @@ -index b670250180..350288269b 100644 +index 27c82d9b44..cd3b0f2e45 100644 @@ -26 +28 @@ -@@ -745,12 +745,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -791,12 +791,26 @@ u16 i40e_clean_asq(struct i40e_hw *hw) @@ -55 +57 @@ -@@ -770,6 +784,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) +@@ -816,6 +830,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw)