]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit()
authorPeilin Ye <peilin.ye@bytedance.com>
Thu, 14 Apr 2022 20:34:26 +0000 (13:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2022 10:48:34 +0000 (11:48 +0100)
Do not update tunnel->tun_hlen in data plane code.  Use a local variable
instead, just like "tunnel_hlen" in net/ipv4/ip_gre.c:gre_fb_xmit().

Co-developed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_gre.c

index 8753e9cec326433a43f1ca357a45384e3ad00c52..b43a46449130bf89a4639915282d8b1556151ce8 100644 (file)
@@ -743,6 +743,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
                struct ip_tunnel_info *tun_info;
                const struct ip_tunnel_key *key;
                __be16 flags;
+               int tun_hlen;
 
                tun_info = skb_tunnel_info_txcheck(skb);
                if (IS_ERR(tun_info) ||
@@ -760,9 +761,9 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
                dsfield = key->tos;
                flags = key->tun_flags &
                        (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ);
-               tunnel->tun_hlen = gre_calc_hlen(flags);
+               tun_hlen = gre_calc_hlen(flags);
 
-               gre_build_header(skb, tunnel->tun_hlen,
+               gre_build_header(skb, tun_hlen,
                                 flags, protocol,
                                 tunnel_id_to_key32(tun_info->key.tun_id),
                                 (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++)