DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiayu Hu <jiayu.hu@intel.com>
To: dev@dpdk.org
Cc: Jiayu Hu <jiayu.hu@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] gro: fix overflow of payload length calculation
Date: Mon, 17 Dec 2018 14:05:39 +0800	[thread overview]
Message-ID: <1545026739-71980-1-git-send-email-jiayu.hu@intel.com> (raw)

When the packet length is smaller than the header length,
the calculated payload length will be overflowed and result
in incorrect reassembly behaviors.

Fixes: 1e4cf4d6d4fb ("gro: cleanup")
Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
Cc: stable@dpdk.org

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 lib/librte_gro/gro_tcp4.c       | 3 ++-
 lib/librte_gro/gro_vxlan_tcp4.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c
index 2c0f35c..2fe9aab 100644
--- a/lib/librte_gro/gro_tcp4.c
+++ b/lib/librte_gro/gro_tcp4.c
@@ -198,7 +198,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
 	struct ipv4_hdr *ipv4_hdr;
 	struct tcp_hdr *tcp_hdr;
 	uint32_t sent_seq;
-	uint16_t tcp_dl, ip_id, hdr_len, frag_off;
+	int32_t tcp_dl;
+	uint16_t ip_id, hdr_len, frag_off;
 	uint8_t is_atomic;
 
 	struct tcp4_flow_key key;
diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c
index ca86f01..955ae4b 100644
--- a/lib/librte_gro/gro_vxlan_tcp4.c
+++ b/lib/librte_gro/gro_vxlan_tcp4.c
@@ -295,7 +295,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,
 	struct udp_hdr *udp_hdr;
 	struct vxlan_hdr *vxlan_hdr;
 	uint32_t sent_seq;
-	uint16_t tcp_dl, frag_off, outer_ip_id, ip_id;
+	int32_t tcp_dl;
+	uint16_t frag_off, outer_ip_id, ip_id;
 	uint8_t outer_is_atomic, is_atomic;
 
 	struct vxlan_tcp4_flow_key key;
-- 
2.7.4

             reply	other threads:[~2018-12-17  6:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17  6:05 Jiayu Hu [this message]
2018-12-19  3:31 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1545026739-71980-1-git-send-email-jiayu.hu@intel.com \
    --to=jiayu.hu@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).