From: Pablo Neira Ayuso Date: Mon, 22 Oct 2018 19:49:45 +0000 (+0200) Subject: netfilter: nft_osf: check if attribute is present X-Git-Tag: v5.4-rc1~2250^2^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e91c9d9cd3fd557226ca75fed58816b9eee7e07;p=platform%2Fkernel%2Flinux-rpi.git netfilter: nft_osf: check if attribute is present If the attribute is not sent, eg. old libnftnl binary, then tb[NFTA_OSF_TTL] is NULL and kernel crashes from the _init path. Fixes: a218dc82f0b5 ("netfilter: nft_osf: Add ttl option support") Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c index ca5e5d8..b13618c 100644 --- a/net/netfilter/nft_osf.c +++ b/net/netfilter/nft_osf.c @@ -50,7 +50,7 @@ static int nft_osf_init(const struct nft_ctx *ctx, int err; u8 ttl; - if (nla_get_u8(tb[NFTA_OSF_TTL])) { + if (tb[NFTA_OSF_TTL]) { ttl = nla_get_u8(tb[NFTA_OSF_TTL]); if (ttl > 2) return -EINVAL;