summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2018-02-07 07:30:08 -0800
committerPravin B Shelar <pshelar@ovn.org>2018-02-12 00:19:10 -0800
commite66064f7a0df8d32b8b1d9e9219b2ab07000d54b (patch)
tree627fac036d5ffb864bff49c31e05078aab60f6f7
parent39f8615821d74b8af938b556bc4741519a987862 (diff)
downloadopenvswitch-e66064f7a0df8d32b8b1d9e9219b2ab07000d54b.tar.gz
datapath: fix data type in queue_gso_packets
Upstream commit: commit 2734166e89639c973c6e125ac8bcfc2d9db72b70 Author: Gustavo A. R. Silva <garsilva@embeddedor.com> Date: Sat Nov 25 13:14:40 2017 -0600 net: openvswitch: datapath: fix data type in queue_gso_packets gso_type is being used in binary AND operations together with SKB_GSO_UDP. The issue is that variable gso_type is of type unsigned short and SKB_GSO_UDP expands to more than 16 bits: SKB_GSO_UDP = 1 << 16 this makes any binary AND operation between gso_type and SKB_GSO_UDP to be always zero, hence making some code unreachable and likely causing undesired behavior. Fix this by changing the data type of variable gso_type to unsigned int. Addresses-Coverity-ID: 1462223 Fixes: 0c19f846d582 ("net: accept UFO datagrams from tuntap and packet") Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> While backporting this I found another couple of instances of the same issue so I fixed them up as well. Cc: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Pravin B Shelar <pshelar@ovn.org>
-rw-r--r--datapath/datapath.c2
-rw-r--r--datapath/linux/compat/stt.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 867345f35..2a2b9df91 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -341,7 +341,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
uint32_t cutlen)
{
#ifdef HAVE_SKB_GSO_UDP
- unsigned short gso_type = skb_shinfo(skb)->gso_type;
+ unsigned int gso_type = skb_shinfo(skb)->gso_type;
struct sw_flow_key later_key;
#endif
struct sk_buff *segs, *nskb;
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index 66a97f2f7..2189476e1 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -1315,7 +1315,7 @@ static bool validate_checksum(struct sk_buff *skb)
static bool set_offloads(struct sk_buff *skb)
{
struct stthdr *stth = stt_hdr(skb);
- unsigned short gso_type = 0;
+ unsigned int gso_type = 0;
int l3_header_size;
int l4_header_size;
u16 csum_offset;