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 8162EA0543 for ; Sat, 5 Nov 2022 18:12:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79AFF42D29; Sat, 5 Nov 2022 18:12:29 +0100 (CET) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mails.dpdk.org (Postfix) with ESMTP id 0C78D400D5 for ; Sat, 5 Nov 2022 18:12:28 +0100 (CET) Received: by mail-wm1-f54.google.com with SMTP id c3-20020a1c3503000000b003bd21e3dd7aso7215363wma.1 for ; Sat, 05 Nov 2022 10:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j5anBjinUmfqeL8ISfNp2JIv48MUdsJfUmtTCMAZXKA=; b=lK5SLGP5L0UJzRQGws/hMtBaveVCD8Ct4yh4f0e/L9HjmJPjl4Z4iTU9w/guaIPOvq 86TBt91MgcX8FoWDhQfp46PMRfYqHO7h6FyjFyhg0c9fA/aTEGFMiLZOrnrKrbfWLEFX b5ywMDyKDsvc+82zLG5apyWIxlH08Y5Pz9wbe10kPgDZmcEwsxLTu9xcdZj81+SAz14Y 6FhBUUApvPMxTLg4W6dm0z5m/QaWmKT0qLg5y5IuJ6BD3fDaFGU0gz5/zLxhtbGVyljE bEtFbgz62fDtgix0YaC+fGhjzXFfkpY2x4NL1u1Bym8CPVgVCUTJ38uvprGqBXCredEg yj/A== 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=j5anBjinUmfqeL8ISfNp2JIv48MUdsJfUmtTCMAZXKA=; b=XaKFOTTxNkTfzw2n/5DkJ+w+u6zycoLsRTcstuLCRoTqpqXGWPdy8zXEXwKHeEws2p NxAO5xYYvKNOKYvII/sfAoAo/R0D/PPwq802a9eSGlTX62aT8bWNp/HOePEPAofuiJKk ui3j2p5xk5NeI2HsVX/wkSBcSXBw5SsnHQpwYaHwBWPkPabXZC/vMQ1ApWiAHNh7IV0G BeLAHZej23NQ37uxIVppUmnh88O+84JantvQROhWCHHCN/vMXVgMtpNK75m79DE5eVFn X6vlOIDAF31apG5j6abfoPWpku7EWehlOmNbUHjPYvVOL6Z3vcfhbvTYmjl6jQBdH+fj mruQ== X-Gm-Message-State: ACrzQf2zLJuV26gaJ/JB/qOhof9GbNLWAUYWxSIYOvla8a7XX2zhP0HO PBmBabZv45HePAKmtDJPTBRaLXbLkus= X-Google-Smtp-Source: AMsMyM6/aVu+02JaH3HzXzPViPIaLlj+2F9X07uPxLjdwFO+siryHz9gRn5i3PGRdasQmFgvh7ILRA== X-Received: by 2002:a05:600c:654a:b0:3c6:f83e:d142 with SMTP id dn10-20020a05600c654a00b003c6f83ed142mr27191157wmb.147.1667668347775; Sat, 05 Nov 2022 10:12:27 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id u8-20020adfeb48000000b002366b17ca8bsm3002377wrn.108.2022.11.05.10.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:12:27 -0700 (PDT) From: luca.boccassi@gmail.com To: Kumara Parameshwaran Cc: Jiayu Hu , dpdk stable Subject: patch 'gro: check payload length after trim' has been queued to stable release 20.11.7 Date: Sat, 5 Nov 2022 17:11:12 +0000 Message-Id: <20221105171146.1520039-13-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221105171146.1520039-1-luca.boccassi@gmail.com> References: <20221103092758.1099402-100-luca.boccassi@gmail.com> <20221105171146.1520039-1-luca.boccassi@gmail.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 20.11.7 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/07/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/36d426123ce28d87ae6c184a2c87eb2721af8e2c Thanks. Luca Boccassi --- >From 36d426123ce28d87ae6c184a2c87eb2721af8e2c Mon Sep 17 00:00:00 2001 From: Kumara Parameshwaran Date: Sun, 16 Oct 2022 20:13:05 +0530 Subject: [PATCH] gro: check payload length after trim [ upstream commit 72f51b097a71fb9bdea13bdd254ff620b34c852e ] When packet is padded with extra bytes the the validation of the payload length should be done after the trim operation Fixes: b8a55871d5af ("gro: trim tail padding bytes") Signed-off-by: Kumara Parameshwaran Acked-by: Jiayu Hu --- lib/librte_gro/gro_tcp4.c | 15 ++++++++------- lib/librte_gro/gro_udp4.c | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 9bde7162b1..15b7ae7d88 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -226,19 +226,20 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, */ if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) return -1; - /* - * Don't process the packet whose payload length is less than or - * equal to 0. - */ - tcp_dl = pkt->pkt_len - hdr_len; - if (tcp_dl <= 0) - return -1; /* trim the tail padding bytes */ ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); + /* + * Don't process the packet whose payload length is less than or + * equal to 0. + */ + tcp_dl = pkt->pkt_len - hdr_len; + if (tcp_dl <= 0) + return -1; + /* * Save IPv4 ID for the packet whose DF bit is 0. For the packet * whose DF bit is 1, IPv4 ID is ignored. diff --git a/lib/librte_gro/gro_udp4.c b/lib/librte_gro/gro_udp4.c index 517e12b12b..e632bee085 100644 --- a/lib/librte_gro/gro_udp4.c +++ b/lib/librte_gro/gro_udp4.c @@ -221,21 +221,21 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, if (!is_ipv4_fragment(ipv4_hdr)) return -1; - /* - * Don't process the packet whose payload length is less than or - * equal to 0. - */ - if (pkt->pkt_len <= hdr_len) - return -1; - ip_dl = rte_be_to_cpu_16(ipv4_hdr->total_length); - if (ip_dl <= pkt->l3_len) - return -1; - /* trim the tail padding bytes */ if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); + /* + * Don't process the packet whose payload length is less than or + * equal to 0. + */ + if (pkt->pkt_len <= hdr_len) + return -1; + + if (ip_dl <= pkt->l3_len) + return -1; + ip_dl -= pkt->l3_len; ip_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); frag_offset = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-05 17:11:09.843232779 +0000 +++ 0013-gro-check-payload-length-after-trim.patch 2022-11-05 17:11:08.602941096 +0000 @@ -1 +1 @@ -From 72f51b097a71fb9bdea13bdd254ff620b34c852e Mon Sep 17 00:00:00 2001 +From 36d426123ce28d87ae6c184a2c87eb2721af8e2c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 72f51b097a71fb9bdea13bdd254ff620b34c852e ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -16,2 +17,2 @@ - lib/gro/gro_tcp4.c | 15 ++++++++------- - lib/gro/gro_udp4.c | 20 ++++++++++---------- + lib/librte_gro/gro_tcp4.c | 15 ++++++++------- + lib/librte_gro/gro_udp4.c | 20 ++++++++++---------- @@ -20,5 +21,5 @@ -diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c -index 8f5e800250..0014096e63 100644 ---- a/lib/gro/gro_tcp4.c -+++ b/lib/gro/gro_tcp4.c -@@ -225,19 +225,20 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, +diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c +index 9bde7162b1..15b7ae7d88 100644 +--- a/lib/librte_gro/gro_tcp4.c ++++ b/lib/librte_gro/gro_tcp4.c +@@ -226,19 +226,20 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, @@ -52,5 +53,5 @@ -diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c -index 839f9748b7..42596d33b6 100644 ---- a/lib/gro/gro_udp4.c -+++ b/lib/gro/gro_udp4.c -@@ -220,21 +220,21 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, +diff --git a/lib/librte_gro/gro_udp4.c b/lib/librte_gro/gro_udp4.c +index 517e12b12b..e632bee085 100644 +--- a/lib/librte_gro/gro_udp4.c ++++ b/lib/librte_gro/gro_udp4.c +@@ -221,21 +221,21 @@ gro_udp4_reassemble(struct rte_mbuf *pkt,