Skip to contentSkip to conversation

gro: fix payload corruption in coalescing packets

PATCH Applied Tathagat Priyadarshi 3 participants 3 messages Sep 2, 2025 – Sep 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gro: fix payload corruption in coalescing packets

In the current implementation when cmp is larger than 0, the new packet is appended to the original packet. However the code is operating on the trailing packet to update the tcp flags which ends up corrupting the payload of the trailing packets.

Fixes 547f29435769 ("gro: fix reordering of packets")
---
 lib/gro/gro_tcp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/gro/gro_tcp.h +1 -1
index e9be7b95d1..43383e47e0 100644
@@ -133,7 +133,7 @@ merge_two_tcp_packets(struct gro_tcp_item *item,
 	pkt_head->nb_segs += pkt_tail->nb_segs;
 	pkt_head->pkt_len += pkt_tail->pkt_len;
 	if (tcp_flags != RTE_TCP_ACK_FLAG) {
-		tcp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_tcp_hdr *,
+		tcp_hdr = rte_pktmbuf_mtod_offset(pkt_head, struct rte_tcp_hdr *,
 						l2_offset + pkt_head->l2_len + pkt_head->l3_len);
 		tcp_hdr->tcp_flags |= tcp_flags;
 	}
Signature · 1 line
2.34.1
#1 lore raw

Reviewed by : @kumaraparameshwaran rathinavel <[email protected]>

Quoted 33 lines · Tathagat Priyadarshi

In the current implementation when cmp is larger than 0, the new packet is appended to the original packet. However the code is operating on the trailing packet to update the tcp flags which ends up corrupting the payload of the trailing packets.

Fixes 547f29435769 ("gro: fix reordering of packets")
---
 lib/gro/gro_tcp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/gro/gro_tcp.h +1 -1
index e9be7b95d1..43383e47e0 100644
@@ -133,7 +133,7 @@ merge_two_tcp_packets(struct gro_tcp_item *item,
        pkt_head->nb_segs += pkt_tail->nb_segs;
        pkt_head->pkt_len += pkt_tail->pkt_len;
        if (tcp_flags != RTE_TCP_ACK_FLAG) {
-               tcp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_tcp_hdr
 *,
+               tcp_hdr = rte_pktmbuf_mtod_offset(pkt_head, struct
 rte_tcp_hdr *,
                                                l2_offset +
pkt_head->l2_len + pkt_head->l3_len);
                tcp_hdr->tcp_flags |= tcp_flags;
        }

--
2.34.1

#2 lore raw

18/09/2025 14:36, kumaraparameshwaran rathinavel:

Quoted 14 lines

Reviewed by : @kumaraparameshwaran rathinavel <[email protected]>

Quoted 9 lines · Tathagat Priyadarshi

In the current implementation when cmp is larger than 0, the new packet is appended to the original packet. However the code is operating on the trailing packet to update the tcp flags which ends up corrupting the payload of the trailing packets.

Fixes 547f29435769 ("gro: fix reordering of packets")

Applied, thanks.