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 925F1A0542 for ; Fri, 11 Nov 2022 11:34:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D252410F2; Fri, 11 Nov 2022 11:34:17 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0CD1D40150 for ; Fri, 11 Nov 2022 11:34:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668162856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3333ZveGPmqWt2i3zp+yoORUpW97VZN5rER3RMpTMuw=; b=df6F+ehoKIkVMhiBkEx2LSjX2WRP09VZFVUW2ISx1Q7NBnQ2E6FvwJFMJXUbPvzJfMqWb7 pzjb5alnxay7CA3SgGOSewPmlPRAWvb4NLzkiPYkyUrJ7xLL+YvV8VQVNz6fW/wjY6ridk DbWyGy1WPOVzkscFmptTFtFTmjLVjM4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-Y-YjNh6uP6ilRCSpq61ULw-1; Fri, 11 Nov 2022 05:34:13 -0500 X-MC-Unique: Y-YjNh6uP6ilRCSpq61ULw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B7B585A5A6; Fri, 11 Nov 2022 10:34:13 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id D744C200E288; Fri, 11 Nov 2022 10:34:11 +0000 (UTC) From: Kevin Traynor To: Kumara Parameshwaran Cc: Jiayu Hu , dpdk stable Subject: patch 'gro: check payload length after trim' has been queued to stable release 21.11.3 Date: Fri, 11 Nov 2022 10:32:55 +0000 Message-Id: <20221111103337.307408-5-ktraynor@redhat.com> In-Reply-To: <20221111103337.307408-1-ktraynor@redhat.com> References: <20221111103337.307408-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.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/14/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/5123b2346536b6858209ca90f4c925413708b17b Thanks. Kevin --- >From 5123b2346536b6858209ca90f4c925413708b17b 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/gro/gro_tcp4.c | 15 ++++++++------- lib/gro/gro_udp4.c | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index ec3d9589b7..a6ca6eacc2 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -227,11 +227,4 @@ 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 */ @@ -240,4 +233,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, 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 diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c index a6d92fe5e7..5a2cabdb88 100644 --- a/lib/gro/gro_udp4.c +++ b/lib/gro/gro_udp4.c @@ -222,19 +222,19 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, 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); -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-11 10:32:17.233525228 +0000 +++ 0005-gro-check-payload-length-after-trim.patch 2022-11-11 10:32:16.999300466 +0000 @@ -1 +1 @@ -From 72f51b097a71fb9bdea13bdd254ff620b34c852e Mon Sep 17 00:00:00 2001 +From 5123b2346536b6858209ca90f4c925413708b17b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 72f51b097a71fb9bdea13bdd254ff620b34c852e ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 8f5e800250..0014096e63 100644 +index ec3d9589b7..a6ca6eacc2 100644 @@ -24 +25 @@ -@@ -226,11 +226,4 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, +@@ -227,11 +227,4 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, @@ -36 +37 @@ -@@ -239,4 +232,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, +@@ -240,4 +233,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, @@ -50 +51 @@ -index 839f9748b7..42596d33b6 100644 +index a6d92fe5e7..5a2cabdb88 100644 @@ -53 +54 @@ -@@ -221,19 +221,19 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, +@@ -222,19 +222,19 @@ gro_udp4_reassemble(struct rte_mbuf *pkt,