From 56174c2bf4577eacdfaef8c77ea82c99e29e4a30 Mon Sep 17 00:00:00 2001 From: Greg Rose Date: Thu, 28 Jun 2018 20:31:25 -0700 Subject: [PATCH] compat: Fix gre header bug Commit 436d36db introduced a bug into the gre header build for gre and ip gre type tunnels. __vlan_hwaccel_push_inside does not check whether the vlan tag is even present. So check first and avoid padding space for a vlan tag that isn't present. Fixes: 436d36db ("compat: Fixups for newer kernels") Signed-off-by: Greg Rose Acked-by: William Tu Signed-off-by: Justin Pettit --- datapath/linux/compat/ip_gre.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index ac9fb8bfcc8..df0217e3b7d 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -552,10 +552,12 @@ netdev_tx_t rpl_gre_fb_xmit(struct sk_buff *skb) goto err_free_rt; } - skb = __vlan_hwaccel_push_inside(skb); - if (unlikely(!skb)) { - err = -ENOMEM; - goto err_free_rt; + if (skb_vlan_tag_present(skb)) { + skb = __vlan_hwaccel_push_inside(skb); + if (unlikely(!skb)) { + err = -ENOMEM; + goto err_free_rt; + } } /* Push Tunnel header. */