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 11782A0C4C for ; Mon, 12 Jul 2021 15:12:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BFF34069D; Mon, 12 Jul 2021 15:12:39 +0200 (CEST) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mails.dpdk.org (Postfix) with ESMTP id 5866E4119C for ; Mon, 12 Jul 2021 15:12:36 +0200 (CEST) Received: by mail-wm1-f52.google.com with SMTP id k32so8174229wms.4 for ; Mon, 12 Jul 2021 06:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YTNjmWPZg7PqqvDnQeZzhCYz/+BvGU1swtSmn7/eGhE=; b=iv/dpMoxd4PiHW2y0wItMkt1JZ64YdIiGPYMVbb5++OfNO+4YwcMSAJ9rWstacnLss qjGT6WxcFxY8JcYm/ZHymCMvVp+xydTh5cGKRb7MxWDOB8N9cjiFAd4xrzZ0HKQ8cPB+ Kb2cCYv8ZE4qXveb8CKO2sc4S5pZXYwyZ+eryYoDbvX6DvvcTQa9vZNpyjLMEzUwDh4i jM+1c190Tr3gam68LJKNEp6BWTNCeXotIGWxpbfPGU8GMEk3Yi2VdebS1iAiWEgloVNH Nh+lxWDaGTNeuVAjd2h5TZy5IfHztSNH966wjhzFhUHkocrsSWywePNtSoRS3WGHN3uN ajKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YTNjmWPZg7PqqvDnQeZzhCYz/+BvGU1swtSmn7/eGhE=; b=FEGXxpZpBu0KmFK3DLLMXMQ4iA4J4U+PaHp2VwVoCO3GXP6IsEV4tV0eqViO3jkaP9 DhIJbm0YkLFABGr/fdpilOfaQhzTG6+a2s6U7vWW1abAqEI3RVJyJriAs2/Jj4ng92kW x0JqYv34ohw4ILrrO8LaJkhC4o9cP12xMhChwUcJp9rG/pnMp4DpaVG2TmoQ6rcuzB3H fVPRx8E5alOlOuTq5IjJY1UxkCteFAhkFBKkav42LVuDxwYeNpgxA1w+9qNZbILYip9b Mq6DYPsEM0bEZ2oDTRa0OitztN6AtXR8bUICTwqP03XlpuqzC62159yKeMdmyJ3Hj0oi 7d+A== X-Gm-Message-State: AOAM5324ilyfAdhY8v6GI8fbPo1SjPb705d6FRRL1FC89sdCpxZHbi8p 5A9rsmJxgvOW1bcA8igcLq4= X-Google-Smtp-Source: ABdhPJyVp9sMqQ6L/fLS6P+Tq3fYzY+pVa/83mstHCgMuWxVmUJAdtTu5otP+HkeRpUHMVBWJfoqxg== X-Received: by 2002:a05:600c:b47:: with SMTP id k7mr18352907wmr.155.1626095556062; Mon, 12 Jul 2021 06:12:36 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id d14sm3706061wrs.49.2021.07.12.06.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:12:35 -0700 (PDT) From: luca.boccassi@gmail.com To: Tudor Cornea Cc: Qi Zhang , dpdk stable Date: Mon, 12 Jul 2021 14:04:43 +0100 Message-Id: <20210712130551.2462159-48-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ice: fix overflow in maximum packet length config' has been queued to stable release 20.11.3 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.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 07/14/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/345f2731ed564636d2b9380c8be01ab4aafc93d0 Thanks. Luca Boccassi --- >From 345f2731ed564636d2b9380c8be01ab4aafc93d0 Mon Sep 17 00:00:00 2001 From: Tudor Cornea Date: Tue, 15 Jun 2021 13:38:34 +0300 Subject: [PATCH] net/ice: fix overflow in maximum packet length config [ upstream commit 58bb86cf13b8535fa8786f97cc9a4dfaa780a51e ] The len variable, used in the computation of max_pkt_len could overflow, if used to store the result of the following computation: ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len Since, we could define the mbuf size to have a large value (i.e 13312), and ICE_SUPPORT_CHAIN_NUM is defined as 5, the computation mentioned above could potentially result in a value which might be bigger than MAX_USHORT. The result will be that Jumbo Frames will not work properly Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF") Signed-off-by: Tudor Cornea Acked-by: Qi Zhang --- drivers/net/ice/ice_dcf_ethdev.c | 7 ++++--- drivers/net/ice/ice_rxtx.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index e5c877805f..71f8a4b4cc 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -48,13 +48,14 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; struct rte_eth_dev_data *dev_data = dev->data; struct iavf_hw *hw = &dcf_ad->real_hw.avf; - uint16_t buf_size, max_pkt_len, len; + uint16_t buf_size, max_pkt_len; buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; rxq->rx_hdr_len = 0; rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); - len = ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len; - max_pkt_len = RTE_MIN(len, dev->data->dev_conf.rxmode.max_rx_pkt_len); + max_pkt_len = RTE_MIN((uint32_t) + ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, + dev->data->dev_conf.rxmode.max_rx_pkt_len); /* Check if the jumbo frame and maximum packet length are set * correctly. diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f9a475cbb8..8ac9411083 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -231,7 +231,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) struct rte_eth_dev_data *dev_data = rxq->vsi->adapter->pf.dev_data; struct ice_rlan_ctx rx_ctx; enum ice_status err; - uint16_t buf_size, len; + uint16_t buf_size; struct rte_eth_rxmode *rxmode = &dev_data->dev_conf.rxmode; uint32_t rxdid = ICE_RXDID_COMMS_OVS; uint32_t regval; @@ -241,8 +241,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) RTE_PKTMBUF_HEADROOM); rxq->rx_hdr_len = 0; rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); - len = ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len; - rxq->max_pkt_len = RTE_MIN(len, + rxq->max_pkt_len = RTE_MIN((uint32_t) + ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, dev_data->dev_conf.rxmode.max_rx_pkt_len); if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:39.121521578 +0100 +++ 0048-net-ice-fix-overflow-in-maximum-packet-length-config.patch 2021-07-12 13:41:36.362119944 +0100 @@ -1 +1 @@ -From 58bb86cf13b8535fa8786f97cc9a4dfaa780a51e Mon Sep 17 00:00:00 2001 +From 345f2731ed564636d2b9380c8be01ab4aafc93d0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 58bb86cf13b8535fa8786f97cc9a4dfaa780a51e ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -29 +30 @@ -index b937cbbb03..f73dc80bd9 100644 +index e5c877805f..71f8a4b4cc 100644 @@ -32 +33 @@ -@@ -54,13 +54,14 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) +@@ -48,13 +48,14 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) @@ -51 +52 @@ -index fc9bb5a3e7..20352b07af 100644 +index f9a475cbb8..8ac9411083 100644 @@ -54 +55 @@ -@@ -258,7 +258,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) +@@ -231,7 +231,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) @@ -63 +64 @@ -@@ -268,8 +268,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) +@@ -241,8 +241,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)