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 26A83A0544 for ; Fri, 11 Nov 2022 12:40:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21D1C42D0C; Fri, 11 Nov 2022 12:40:29 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 0346D40141 for ; Fri, 11 Nov 2022 12:40:28 +0100 (CET) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C61BA42240 for ; Fri, 11 Nov 2022 11:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668166827; bh=e2p2Z0uP0ZGO39O8JRGIZlNH8EY7yC13C+ZNt5rTrRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mhvIICM6ozY+MOmVXSpT3cu39CxzrNhj5tyO+k5CSsaYLI9VyoriawSteTbelDJDm 8FQFoerooyRbwBjk+5C/4ekdKINRES35OtojoWM99hCZ5AKutOvsLlJIznW9jvWWEp fnRpZc+CkCk4Z5NcUSCdrwXyZ61esddpvfEurvQDepeh5JJ8Gw3enAnUAwB3SIdTe0 rY8oLBy/hp/63kxnWFKPCeaws05RQM/Fdy9QD408YvMuISVnoXvxJqNVFVvjXVsugm R154SO1Gi+znY5uagT1aOe5et2gaMnmywdaLKo2MY5AR/hnOYQ54JcqgKYhG6KZjpO yGqFoQjBmBfMw== Received: by mail-ed1-f71.google.com with SMTP id r12-20020a05640251cc00b00463699c95aeso3452797edd.18 for ; Fri, 11 Nov 2022 03:40:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e2p2Z0uP0ZGO39O8JRGIZlNH8EY7yC13C+ZNt5rTrRg=; b=Sz04BNsBKqjy0+ro5nk6J37Rd3INNh7kCkXoL/flWhpJUjh41vcra72iJEa7AXNREv 3+nRhpa3IO32lSfFh+W+JbAw16qq7qXoMY1Unr1EmQRhvo7K+px9DN0xhIRpGUh6Axnz rQMhF9taqi6I31DGmJPxy53eQKpaBmVC88kI7HtUD/iLlN/aaEY2+Av8iL8T9zoSo6xz el2bPb/gC0gaOvXGt+PJy6VaBZZHtkcQ0IzUClAuYrIEcw+HSd/A2C4jRQ8KZlczvnii KsFjfFSV5e0ngjtM7xVOVjfKudnrc2UXS8G/E1h3eEYLvPcPLd8t8CBFhzgqNHzGFeGM ixeA== X-Gm-Message-State: ANoB5plVm1cHEl3VC9OYOVKnxwc1We1h/tfY8KjknOnqewr2gwsWLObE X5ufZOI0N8kLU90voafK54u1IdQwywyejd7fo/x9kC1yPVuh30C6z9Q5tvG8jXQYx5cSjNbmm8G F6LMhgvJN/rEEIXALRJZPZ9DL X-Received: by 2002:a17:906:7ac6:b0:7ae:6746:f26b with SMTP id k6-20020a1709067ac600b007ae6746f26bmr1542560ejo.171.1668166827538; Fri, 11 Nov 2022 03:40:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf7d8bUKiwEYVrlacQpC4j7/q24+QGvHlnDt2gkw8ANzo5agH8Oq4Kx9esCREiNEv4GoU0v0QA== X-Received: by 2002:a17:906:7ac6:b0:7ae:6746:f26b with SMTP id k6-20020a1709067ac600b007ae6746f26bmr1542551ejo.171.1668166827320; Fri, 11 Nov 2022 03:40:27 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39af:c100:1891:6c61:50fd:e567]) by smtp.gmail.com with ESMTPSA id n23-20020a170906701700b0078db18d7972sm777713ejj.117.2022.11.11.03.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 03:40:26 -0800 (PST) From: christian.ehrhardt@canonical.com To: Kevin Liu Cc: Qi Zhang , dpdk stable Subject: patch 'net/ice: check illegal packet sizes' has been queued to stable release 19.11.14 Date: Fri, 11 Nov 2022 12:38:42 +0100 Message-Id: <20221111113904.1549618-25-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> References: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.14 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/18/22. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/2ed40158257f2739a69b7689d7f24b5ce79a7a9a Thanks. Christian Ehrhardt --- >From 2ed40158257f2739a69b7689d7f24b5ce79a7a9a Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Tue, 27 Sep 2022 07:15:22 +0000 Subject: [PATCH] net/ice: check illegal packet sizes [ upstream commit ccf33dccf7aaf208ef67ed7b8ef45d05bce5e3a5 ] If the length of data_len in mbuf is less than 17 or greater than the maximum frame size, it is illegal. These illegal packets will lead to Tx/Rx hang and can't recover automatically. This patch check those illegal packets and protect Tx/Rx from hanging. Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx") Signed-off-by: Kevin Liu Acked-by: Qi Zhang --- drivers/net/ice/ice_rxtx.c | 11 +++++++++++ drivers/net/ice/ice_rxtx.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 53f336e85e..f97d93a78d 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -2955,6 +2955,9 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, int i, ret; uint64_t ol_flags; struct rte_mbuf *m; + struct ice_tx_queue *txq = tx_queue; + struct rte_eth_dev *dev = &rte_eth_devices[txq->port_id]; + uint16_t max_frame_size = dev->data->mtu + ICE_ETH_OVERHEAD; for (i = 0; i < nb_pkts; i++) { m = tx_pkts[i]; @@ -2971,6 +2974,14 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } + /* check the data_len in mbuf */ + if (m->data_len < ICE_TX_MIN_PKT_LEN || + m->data_len > max_frame_size) { + rte_errno = EINVAL; + PMD_DRV_LOG(ERR, "INVALID mbuf: bad data_len=[%hu]", m->data_len); + return i; + } + #ifdef RTE_LIBRTE_ETHDEV_DEBUG ret = rte_validate_tx_offload(m); if (ret != 0) { diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 16fd9cbaf9..54117bcb4b 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -38,6 +38,8 @@ #define ICE_FDIR_PKT_LEN 512 +#define ICE_TX_MIN_PKT_LEN 17 + typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); typedef void (*ice_tx_release_mbufs_t)(struct ice_tx_queue *txq); -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-11 12:35:05.683251410 +0100 +++ 0025-net-ice-check-illegal-packet-sizes.patch 2022-11-11 12:35:04.769192040 +0100 @@ -1 +1 @@ -From ccf33dccf7aaf208ef67ed7b8ef45d05bce5e3a5 Mon Sep 17 00:00:00 2001 +From 2ed40158257f2739a69b7689d7f24b5ce79a7a9a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ccf33dccf7aaf208ef67ed7b8ef45d05bce5e3a5 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 5af7c0c8f6..d1e1fadf9d 100644 +index 53f336e85e..f97d93a78d 100644 @@ -29 +30 @@ -@@ -3442,6 +3442,9 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +@@ -2955,6 +2955,9 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, @@ -39 +40 @@ -@@ -3458,6 +3461,14 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +@@ -2971,6 +2974,14 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, @@ -51 +52 @@ - #ifdef RTE_ETHDEV_DEBUG_TX + #ifdef RTE_LIBRTE_ETHDEV_DEBUG @@ -55 +56 @@ -index 6c08c175dc..e1d4fe8e47 100644 +index 16fd9cbaf9..54117bcb4b 100644 @@ -58 +59 @@ -@@ -40,6 +40,8 @@ +@@ -38,6 +38,8 @@ @@ -60 +61 @@ - #define ICE_RXDID_COMMS_OVS 22 + #define ICE_FDIR_PKT_LEN 512 @@ -64,2 +65,2 @@ - extern uint64_t ice_timestamp_dynflag; - extern int ice_timestamp_dynfield_offset; + typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); + typedef void (*ice_tx_release_mbufs_t)(struct ice_tx_queue *txq);