diff mbox series

[ovs-dev,09/12] datapath: fix data type in queue_gso_packets

Message ID 1513029033-9087-10-git-send-email-gvrose8192@gmail.com
State Changes Requested
Delegated to: Justin Pettit
Headers show
Series Backport upstream Linux OVS patches | expand

Commit Message

Gregory Rose Dec. 11, 2017, 9:50 p.m. UTC
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>

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>

Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
 datapath/datapath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/datapath/datapath.c b/datapath/datapath.c
index eff9f85..9baa52e 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -312,7 +312,7 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 			     const struct dp_upcall_info *upcall_info,
 				 uint32_t cutlen)
-	unsigned short gso_type = skb_shinfo(skb)->gso_type;
+	unsigned int gso_type = skb_shinfo(skb)->gso_type;
 	struct sw_flow_key later_key;
 	struct sk_buff *segs, *nskb;
 	struct ovs_skb_cb ovs_cb;