]> git.droids-corp.org - dpdk.git/commitdiff
gro: fix overflow of payload length calculation
authorJiayu Hu <jiayu.hu@intel.com>
Mon, 17 Dec 2018 06:05:39 +0000 (14:05 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 19 Dec 2018 03:29:57 +0000 (04:29 +0100)
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
lib/librte_gro/gro_vxlan_tcp4.c

index 2c0f35c6dda20c6e6f8b619c32110061b256b161..2fe9aab3e75ff8853b37d673d31b1ed53c660ddb 100644 (file)
@@ -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;
index ca86f010ca793b792b613f84cd869d86a476ebe3..955ae4b568ea19324b0d6531ff3c568d500ea1ec 100644 (file)
@@ -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;