From dfe999407a09cfa7052ab873fdebd4e910ac1312 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Tue, 2 Aug 2016 17:03:41 -0700 Subject: [PATCH] datapath: fix size of struct ovs_gso_cb struct ovs_gso_cb is stored in skb->cd. avoid going beyond size of skb->cb. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/linux/compat/gso.c | 1 + datapath/linux/compat/gso.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c index 1f24e74fd..10412c0c9 100644 --- a/datapath/linux/compat/gso.c +++ b/datapath/linux/compat/gso.c @@ -171,6 +171,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb, __be16 proto = skb->protocol; char cb[sizeof(skb->cb)]; + BUILD_BUG_ON(sizeof(struct ovs_gso_cb) > FIELD_SIZEOF(struct sk_buff, cb)); OVS_GSO_CB(skb)->ipv6 = (sa_family == AF_INET6); /* setup whole inner packet to get protocol. */ __skb_pull(skb, mac_offset); diff --git a/datapath/linux/compat/gso.h b/datapath/linux/compat/gso.h index fa0a7db53..e93998c71 100644 --- a/datapath/linux/compat/gso.h +++ b/datapath/linux/compat/gso.h @@ -14,6 +14,7 @@ struct ovs_gso_cb { #ifndef USE_UPSTREAM_TUNNEL_GSO gso_fix_segment_t fix_segment; #endif + bool ipv6; #ifndef HAVE_INNER_PROTOCOL __be16 inner_protocol; #endif @@ -21,7 +22,6 @@ struct ovs_gso_cb { /* Keep original tunnel info during userspace action execution. */ struct metadata_dst *fill_md_dst; #endif - bool ipv6; }; #define OVS_GSO_CB(skb) ((struct ovs_gso_cb *)(skb)->cb)