patch 'gro: check payload length after trim' has been queued to stable release 20.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Sat Nov 5 18:11:12 CET 2022


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 <kumaraparamesh92 at gmail.com>
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 <kumaraparamesh92 at gmail.com>
Acked-by: Jiayu Hu <jiayu.hu at intel.com>
---
 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 at 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,


More information about the stable mailing list