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 E1BFE43B7D for ; Tue, 5 Mar 2024 10:57:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCFEF4161A; Tue, 5 Mar 2024 10:57:03 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 351CF4026B for ; Tue, 5 Mar 2024 10:57:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j5y/A2p1OdJUv8Qp9mJZj2wAnwCIp6UC1KPMveCuVflFlWsYnZOIWQ55AaDoKPz95jn0xjeRfvx9XVAJogai5jE3xxh2tV2Q8QyKnVKFA0ftFRpqSZLCboMMWdLnfoQnibwArdQwjYK04gU2Sid8ZEgJsGdPJbnqdgk5cV1fy3Bx1kLy41vI/0kdZBQqGSuORBebsomK7wIFqtf31l6QjYzt8HANkQkbyIbrnW+gIqouopGOvk30/pkpDBfV++GZ4+d/xo5WtGtexzUxWxEZwwqw/Itw35J9au3AhHh62JWPToTIyXif87TqCnJNLIAqKEaWtxUPE8TRtmADs0eMPA== 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=sj25hM2cvpehiDrdaHZEOTFFw13pi6Mqele3n4tTVnc=; b=SkQ7l/0RYkdT6p3RBRlyY/+Jiml6IU4TfWeOqpmVGJRcEcVlNc+tdms0wu0NjOQFfoxDVfEfJbchsFVzm1839MVw84PPdI1T7GFjBkg2qfu9cEbPjQaPu9DmozbY2CoJKOrSQ9thc2yUCTYNF0KjuIY6JxYNgPmrCdvtyuLVnZ8CWGC1wtBvKmdPvQSAlFDtzDMmYolSK/k9KXZDabENJGdIYOaXXXEj7WrhsMbp/CBcMwCw4/UI7nHyMcWR0W1z7eHWDAkHFkHvK9c4Rr3drtBlE2TxE2kCM1382YGM+259Hhy+YsmCDG2vmxM/14Aq6/lsiDbadVtVENS9m3mpAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=microsoft.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=sj25hM2cvpehiDrdaHZEOTFFw13pi6Mqele3n4tTVnc=; b=SOOkhNkw06/B2DOxAY1hBsQF14HY0uO5WdEE1H0DVOZo4QrzNOeIcmFX+jjPOvgVF07o7ZxzGU6TBfX4Mjre5GPzdP3c8PSBHisANVzU+uFA/ex3oE4YDl+yNGIp2Vt/358N4u7rGthMdRN5zjSBcAzBYsNVDELVlZ+8pk6yLSRdgFTxvr9rrxvEDhkW0BGfw67I3tMAzWexwWWvuS1y9USx80p4RXHeumDNYzNcsqE/G7jikn1n2IZBeNLbG9auLDjKMJd4V/g/Pj0HEjVFUPozyLvWHmmm/ZV8ZEWlbwz96cNUxME7bQJWNmaggowy0iGXn3ica2F+q3hP/edfSA== Received: from MW4PR04CA0076.namprd04.prod.outlook.com (2603:10b6:303:6b::21) by CYYPR12MB8856.namprd12.prod.outlook.com (2603:10b6:930:c0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 09:57:00 +0000 Received: from CO1PEPF000042AC.namprd03.prod.outlook.com (2603:10b6:303:6b:cafe::59) by MW4PR04CA0076.outlook.office365.com (2603:10b6:303:6b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:56:59 +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 CO1PEPF000042AC.mail.protection.outlook.com (10.167.243.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:56:59 +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.986.41; Tue, 5 Mar 2024 01:56:45 -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.1258.12; Tue, 5 Mar 2024 01:56:44 -0800 From: Xueming Li To: Long Li CC: dpdk stable Subject: patch 'net/mana: prevent values overflow returned from RDMA layer' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:47:19 +0800 Message-ID: <20240305094757.439387-99-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-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: CO1PEPF000042AC:EE_|CYYPR12MB8856:EE_ X-MS-Office365-Filtering-Correlation-Id: f17dd97a-6f00-48fa-21a1-08dc3cfa99c3 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3pWERb+fhhBPyGQsRGBlV5HTPbcmzDtxeqZjj/+E82vsfhUy4/IYmxPQsCD1RDbXvPMyLyELJDlNq1u7Gruwbh2r7OmY6A0r938PGcq2R3ScKSoMO2co9P30D4kbX1zGEYBjqnG9jhdGDrLjeEpKCOE5Hzc+WBxyrtdgJUinpjXjhcYtfy3f9XifDHw7zMiXrH+OpZF1DHrwdpsfAuzYqGsDLpgGiF8NgBF09jWoc94IuYgIw8ZGh+R6iP0iYZk60DW+fC3clNhpDI7GAY3BJsc5zg5aoZxZq1c2vQpDqtoRFA24pC9C5t61ewPXU4VWhFCMhyhswThXuuxJFkN52siMBmbHvkiH/I7PCVaf2rCsbXvVUAVwUI6qtSfMUbPbgJuebWqDLvaDjMqy8U1bTxC9CJXm9/V5dl2wZcRt1KnmJd5M1CkPdBe9MK3C3X4csxaSgKRsvhQXL0Xf1lfSLSg6pawiamVIisgD2m6RtAroDmdcDUGSTgzCYtGx4L8JU3hS0AO054nYNk4P+cC/MESSTpGhpv5+pIbuk2zsW328GyiFMNrK8yHNig+NRTrV/6KCxkKZzmcU7EmTqWIS4NQbe18I61sgn1JclNBS+Ru3WOMQoD0zg9Nc0SuFoNhBXUTIvpl+ag1/S/axYcrDUOINwBCL69v8mjgiwwKjHzOxVh+KvTQRpnJ+oInXQqxi+oxOneMFRxKxxGxMm4JaHf7dpAKYuuutYlRBVmk3PKTR+hIn358e2O/+/WZ+Kztl 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:(13230031)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:56:59.7554 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f17dd97a-6f00-48fa-21a1-08dc3cfa99c3 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: CO1PEPF000042AC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8856 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.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/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=7de2520f2d4c410c26528e46075739c0b7e82715 Thanks. Xueming Li --- >From 7de2520f2d4c410c26528e46075739c0b7e82715 Mon Sep 17 00:00:00 2001 From: Long Li Date: Thu, 18 Jan 2024 10:05:37 -0800 Subject: [PATCH] net/mana: prevent values overflow returned from RDMA layer Cc: Xueming Li [ upstream commit b7e79896c47e9b884eaed1bac439f84250fd959f ] The device capabilities reported from RDMA layer are in int. Those values can overflow with the data types defined in dev_info_get(). Fix this by doing a upper bound before returning those values. Fixes: 517ed6e2d590 ("net/mana: add basic driver with build environment") Signed-off-by: Long Li --- drivers/net/mana/mana.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index 781ed76139..58257c971e 100644 --- a/drivers/net/mana/mana.c +++ b/drivers/net/mana/mana.c @@ -296,8 +296,8 @@ mana_dev_info_get(struct rte_eth_dev *dev, dev_info->min_rx_bufsize = MIN_RX_BUF_SIZE; dev_info->max_rx_pktlen = MANA_MAX_MTU + RTE_ETHER_HDR_LEN; - dev_info->max_rx_queues = priv->max_rx_queues; - dev_info->max_tx_queues = priv->max_tx_queues; + dev_info->max_rx_queues = RTE_MIN(priv->max_rx_queues, UINT16_MAX); + dev_info->max_tx_queues = RTE_MIN(priv->max_tx_queues, UINT16_MAX); dev_info->max_mac_addrs = MANA_MAX_MAC_ADDR; dev_info->max_hash_mac_addrs = 0; @@ -338,16 +338,20 @@ mana_dev_info_get(struct rte_eth_dev *dev, /* Buffer limits */ dev_info->rx_desc_lim.nb_min = MIN_BUFFERS_PER_QUEUE; - dev_info->rx_desc_lim.nb_max = priv->max_rx_desc; + dev_info->rx_desc_lim.nb_max = RTE_MIN(priv->max_rx_desc, UINT16_MAX); dev_info->rx_desc_lim.nb_align = MIN_BUFFERS_PER_QUEUE; - dev_info->rx_desc_lim.nb_seg_max = priv->max_recv_sge; - dev_info->rx_desc_lim.nb_mtu_seg_max = priv->max_recv_sge; + dev_info->rx_desc_lim.nb_seg_max = + RTE_MIN(priv->max_recv_sge, UINT16_MAX); + dev_info->rx_desc_lim.nb_mtu_seg_max = + RTE_MIN(priv->max_recv_sge, UINT16_MAX); dev_info->tx_desc_lim.nb_min = MIN_BUFFERS_PER_QUEUE; - dev_info->tx_desc_lim.nb_max = priv->max_tx_desc; + dev_info->tx_desc_lim.nb_max = RTE_MIN(priv->max_tx_desc, UINT16_MAX); dev_info->tx_desc_lim.nb_align = MIN_BUFFERS_PER_QUEUE; - dev_info->tx_desc_lim.nb_seg_max = priv->max_send_sge; - dev_info->rx_desc_lim.nb_mtu_seg_max = priv->max_recv_sge; + dev_info->tx_desc_lim.nb_seg_max = + RTE_MIN(priv->max_send_sge, UINT16_MAX); + dev_info->tx_desc_lim.nb_mtu_seg_max = + RTE_MIN(priv->max_send_sge, UINT16_MAX); /* Speed */ dev_info->speed_capa = RTE_ETH_LINK_SPEED_100G; @@ -1385,9 +1389,9 @@ mana_probe_port(struct ibv_device *ibdev, struct ibv_device_attr_ex *dev_attr, priv->max_mr = dev_attr->orig_attr.max_mr; priv->max_mr_size = dev_attr->orig_attr.max_mr_size; - DRV_LOG(INFO, "dev %s max queues %d desc %d sge %d", + DRV_LOG(INFO, "dev %s max queues %d desc %d sge %d mr %" PRIu64, name, priv->max_rx_queues, priv->max_rx_desc, - priv->max_send_sge); + priv->max_send_sge, priv->max_mr_size); rte_eth_copy_pci_info(eth_dev, pci_dev); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:33.942120198 +0800 +++ 0098-net-mana-prevent-values-overflow-returned-from-RDMA-.patch 2024-03-05 17:39:30.863566496 +0800 @@ -1 +1 @@ -From b7e79896c47e9b884eaed1bac439f84250fd959f Mon Sep 17 00:00:00 2001 +From 7de2520f2d4c410c26528e46075739c0b7e82715 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit b7e79896c47e9b884eaed1bac439f84250fd959f ] @@ -12 +14,0 @@ -Cc: stable@dpdk.org