From: Florian Westphal Date: Sat, 18 Jan 2020 10:27:25 +0000 (+0100) Subject: netfilter: nft_osf: add missing check for DREG attribute X-Git-Tag: v4.19.100~54 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=666a530b2e022bc4bd90fe1770f75fae9b1c15b9;p=thirdparty%2Fkernel%2Fstable.git netfilter: nft_osf: add missing check for DREG attribute commit 7eaecf7963c1c8f62d62c6a8e7c439b0e7f2d365 upstream. syzbot reports just another NULL deref crash because of missing test for presence of the attribute. Reported-by: syzbot+cf23983d697c26c34f60@syzkaller.appspotmail.com Fixes: b96af92d6eaf9fadd ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c index df4e3e0412ed3..a003533ff4d93 100644 --- a/net/netfilter/nft_osf.c +++ b/net/netfilter/nft_osf.c @@ -47,6 +47,9 @@ static int nft_osf_init(const struct nft_ctx *ctx, struct nft_osf *priv = nft_expr_priv(expr); int err; + if (!tb[NFTA_OSF_DREG]) + return -EINVAL; + priv->dreg = nft_parse_register(tb[NFTA_OSF_DREG]); err = nft_validate_register_store(ctx, priv->dreg, NULL, NFT_DATA_VALUE, NFT_OSF_MAXGENRELEN);