From: William Tu Date: Fri, 9 Mar 2018 15:34:41 +0000 (-0800) Subject: ip6erspan: improve error handling for erspan version number. X-Git-Tag: v4.16-rc7~23^2~61^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d6aa71197ffcb68850bfebfc3fc160abe41df53b;p=uclinux-h8%2Flinux.git ip6erspan: improve error handling for erspan version number. When users fill in incorrect erspan version number through the struct erspan_metadata uapi, current code skips pushing the erspan header but continue pushing the gre header, which is incorrect. The patch fixes it by returning error. Signed-off-by: William Tu Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 83c2fffd40be..a299f5424e16 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -945,6 +945,8 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, md->u.md2.dir, get_hwid(&md->u.md2), truncate, false); + } else { + goto tx_err; } } else { switch (skb->protocol) {