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 01D7245CE3 for ; Mon, 11 Nov 2024 07:39:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0CB24067A; Mon, 11 Nov 2024 07:39:41 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by mails.dpdk.org (Postfix) with ESMTP id 820284067A for ; Mon, 11 Nov 2024 07:39:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y3xu6eASWyNHEz0oeBLv1CEVbqX0w0q8taHSRPRAfN4q+FGqTYN9BZUkRlFgVWIYeRQdLu9OFHREJ4WWPlIg3v7Bdvcq+1JfAilupA62JU0unPzhIW6OaDN7DL6ApqR8tJ3AeymY4ioWbcX9rwh3lzHDWS/x2Rjs97KIZRycx7PO4llV66UD+v3jk3ecnTXg5fG5TAwAWbtcgOcQaz/q4lItGx0zL/qMkljOpYOQJmGzVHjyv3ALTk4SjhIqktuio2Rmpw9jKEqn0MhJwSknpcv1ap8qUa6MKFvOsBZTUVtb+71R0JSFndd6NX1m+zClRAh8nyogHZ2iL83dxaFybA== 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=ET2+BR7TqEF7faKnCHiNc+qgezH3coYWqL2BQx/DzXU=; b=DabsHggA/CgKYo5sS5Y0EXg3Ekan7XZQq5/ks4cXLF6S6Wzg5bXnHcTujHXDXcZqUYni5qQJZroHKvuLlw3F4tfduFzLeAlRyRyA4iqUY7SkfgNasukF2aqZK7dh4cKPbQY5AeLlV+sxQ4n/LJ4rkn+KzY8z8EKzuuIsio4/9QDP+y/ci48xz5rwOloWF39JsQtGwKwsW3jinDeYuE2XnR3K3416QDUCtzmDecLl8/0P6KbpA5EWt/LV7/vp4c9NCgX3ATu0C+sveJFDMuAoOOR5w5rVUK09AIeTZ2F5V0RctOnwK5x3t7aJe3PrPGnvXjlGPCXLoKdL4pbVPMTbfw== 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=ET2+BR7TqEF7faKnCHiNc+qgezH3coYWqL2BQx/DzXU=; b=Agav5vQJ5EPaNCF57b6wxM6X5PKMZwn6xphPi161lODoVBGKGPtoSnH/KjjHzvCAGGFEJUxzazLMBmvEAjXgoG1SgmpIuUqor08J6htJ+fzI75NuSYD75YTDjiasOhBZ3mjP8tm6XNzhr2MdCKvnCBR+dU2of/y6Nxcpg8JH2aRbiELCb0bqJA7NU3pmCIoWZnwkW9FKgMaCNN1fscx0ONnseh5qDSUECCqssL8JCYc/R95x9qr7bkYt8fUg8WVjCfXpb5kJzYPwftXSsIUUpcFyAP/GwvaX6+elu9N5HNzpT8QL+xhnf/7QEUOXxSJnua5h+izuHcQxLjU+Xym8dQ== Received: from SJ0PR13CA0151.namprd13.prod.outlook.com (2603:10b6:a03:2c7::6) by SN7PR12MB6838.namprd12.prod.outlook.com (2603:10b6:806:266::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 06:39:37 +0000 Received: from SJ1PEPF00001CE2.namprd05.prod.outlook.com (2603:10b6:a03:2c7:cafe::e3) by SJ0PR13CA0151.outlook.office365.com (2603:10b6:a03:2c7::6) 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:39:37 +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 SJ1PEPF00001CE2.mail.protection.outlook.com (10.167.242.10) 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:39:37 +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:39:26 -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:39:24 -0800 From: Xueming Li To: Fabio Pricoco CC: , Bruce Richardson , Vladimir Medvedkin , dpdk stable Subject: patch 'net/ice/base: add bounds check' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:28:27 +0800 Message-ID: <20241111062847.216344-102-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: SJ1PEPF00001CE2:EE_|SN7PR12MB6838:EE_ X-MS-Office365-Filtering-Correlation-Id: dbf8860f-5e1b-471e-1f6b-08dd021b9d09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sJiBVjIw7uexFrLYHzapNZuquFKe5IFtDSW37zEt0jYOVJGY0b7SXfuoBbpN?= =?us-ascii?Q?w4N/OGOiklwxb/d5QI9AJGRWXjamBXjTZHiFl3Q5k7qCYelLEEQRr9X3FX1i?= =?us-ascii?Q?LxcZrLgDJuCufj6Y0/ii91hxdiTrz4gtwWmLi2gxLiQ0KNFe7wzdKAnJk88+?= =?us-ascii?Q?j3Pt/7j1eJrgz0K/UL/5ANsx6UwMdT3QlJOa9mTmYMyvceAupXjD7LNFrHmU?= =?us-ascii?Q?caLLag3oxr2buvP0xhX3xRizXDKyyu/GhLH1M5hRmhc41bM5cHp47cP5ToLI?= =?us-ascii?Q?yDO2cLq5xDJjPfDK2OcTfc7m2MOn3zZHm1KSp8r2BXxC6brlRV+pHeFBaETK?= =?us-ascii?Q?/tGsUiAMde5eCupk+iozNd76At/SpsIiqbjVeME7makrGo3/jcIqw83h7L+y?= =?us-ascii?Q?YBUR4yRKhRWPk3LcnhM8r/XOQYzAI7hPpHTmM8xkEM3JPZI967qOwBjGgYu9?= =?us-ascii?Q?enSN7B0/zTR5niGen4HH1tAg0xRVLoBlplTf+ZHu78lSpB/ctNAF89uYmsCN?= =?us-ascii?Q?rvayK5d+amPCPKU6G7eo0vHg7Y25YUmCcw0SY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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)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:39:37.8159 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbf8860f-5e1b-471e-1f6b-08dd021b9d09 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: SJ1PEPF00001CE2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6838 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=0df9a046c7c8315e7ec101eca515c5ea7a5b44e7 Thanks. Xueming Li --- >From 0df9a046c7c8315e7ec101eca515c5ea7a5b44e7 Mon Sep 17 00:00:00 2001 From: Fabio Pricoco Date: Mon, 14 Oct 2024 12:02:06 +0100 Subject: [PATCH] net/ice/base: add bounds check Cc: Xueming Li [ upstream commit 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 ] Refactor while loop to add a check that the values read are in the correct range. Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information") Signed-off-by: Fabio Pricoco Signed-off-by: Bruce Richardson Acked-by: Vladimir Medvedkin --- drivers/net/ice/base/ice_controlq.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c index c34407b48c..4896fd2731 100644 --- a/drivers/net/ice/base/ice_controlq.c +++ b/drivers/net/ice/base/ice_controlq.c @@ -846,12 +846,23 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) u16 ntc = sq->next_to_clean; struct ice_sq_cd *details; struct ice_aq_desc *desc; + u32 head; desc = ICE_CTL_Q_DESC(*sq, ntc); details = ICE_CTL_Q_DETAILS(*sq, ntc); - while (rd32(hw, cq->sq.head) != ntc) { - ice_debug(hw, ICE_DBG_AQ_MSG, "ntc %d head %d.\n", ntc, rd32(hw, cq->sq.head)); + head = rd32(hw, sq->head); + if (head >= sq->count) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "Read head value (%d) exceeds allowed range.\n", + head); + return 0; + } + + while (head != ntc) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "ntc %d head %d.\n", + ntc, head); ice_memset(desc, 0, sizeof(*desc), ICE_DMA_MEM); ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); ntc++; @@ -859,6 +870,14 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) ntc = 0; desc = ICE_CTL_Q_DESC(*sq, ntc); details = ICE_CTL_Q_DETAILS(*sq, ntc); + + head = rd32(hw, sq->head); + if (head >= sq->count) { + ice_debug(hw, ICE_DBG_AQ_MSG, + "Read head value (%d) exceeds allowed range.\n", + head); + return 0; + } } sq->next_to_clean = ntc; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:09.692233347 +0800 +++ 0101-net-ice-base-add-bounds-check.patch 2024-11-11 14:23:05.282192836 +0800 @@ -1 +1 @@ -From 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 Mon Sep 17 00:00:00 2001 +From 0df9a046c7c8315e7ec101eca515c5ea7a5b44e7 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9378aa47f45fa5cd5be219c8eb770f096e8a4c27 ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +22 @@ -index af27dc8542..b210495827 100644 +index c34407b48c..4896fd2731 100644 @@ -23,2 +25 @@ -@@ -839,16 +839,35 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) - struct ice_ctl_q_ring *sq = &cq->sq; +@@ -846,12 +846,23 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -25,0 +27 @@ + struct ice_sq_cd *details; @@ -29,0 +32 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc); @@ -45,0 +49 @@ + ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM); @@ -47 +51 @@ - if (ntc == sq->count) +@@ -859,6 +870,14 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) @@ -49,0 +54 @@ + details = ICE_CTL_Q_DETAILS(*sq, ntc);