Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 584661cc authored by William Tu's avatar William Tu Committed by Greg Kroah-Hartman
Browse files

erspan: Check IFLA_GRE_ERSPAN_VER is set.



commit 51fa960d3b5163b1af22efdebcabfccc5d615ad6 upstream.

Add a check to make sure the IFLA_GRE_ERSPAN_VER is provided by users.

Fixes: f989d546a2d5 ("erspan: Add type I version 0 support.")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cc065e1b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1182,7 +1182,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 */