Skip to content

Commit

Permalink
erspan: Check IFLA_GRE_ERSPAN_VER is set.
Browse files Browse the repository at this point in the history
Add a check to make sure the IFLA_GRE_ERSPAN_VER is provided by users.

Fixes: f989d54 ("erspan: Add type I version 0 support.")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
William Tu authored and David S. Miller committed May 12, 2020
1 parent 113cb8f commit 51fa960
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,8 @@ static int erspan_validate(struct nlattr *tb[], struct nlattr *data[],
if (ret)
return ret;

if (nla_get_u8(data[IFLA_GRE_ERSPAN_VER]) == 0)
if (data[IFLA_GRE_ERSPAN_VER] &&
nla_get_u8(data[IFLA_GRE_ERSPAN_VER]) == 0)
return 0;

/* ERSPAN type II/III should only have GRE sequence and key flag */
Expand Down

0 comments on commit 51fa960

Please sign in to comment.