From: Florian Westphal Date: Thu, 16 Jan 2020 07:58:05 +0000 (+0100) Subject: netfilter: nft_tunnel: ERSPAN_VERSION must not be null X-Git-Tag: v5.5-rc7~2^2~11^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ec22d7c6c69146180577f3ad5fdf504beeaee62;p=thirdparty%2Fkernel%2Flinux.git netfilter: nft_tunnel: ERSPAN_VERSION must not be null Fixes: af308b94a2a4a5 ("netfilter: nf_tables: add tunnel support") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c index d89c7c5530309..5284fcf16be73 100644 --- a/net/netfilter/nft_tunnel.c +++ b/net/netfilter/nft_tunnel.c @@ -266,6 +266,9 @@ static int nft_tunnel_obj_erspan_init(const struct nlattr *attr, if (err < 0) return err; + if (!tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION]) + return -EINVAL; + version = ntohl(nla_get_be32(tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION])); switch (version) { case ERSPAN_VERSION: