]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netfilter: nft_osf: add missing check for DREG attribute
authorFlorian Westphal <fw@strlen.de>
Sat, 18 Jan 2020 10:27:25 +0000 (11:27 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 18 Jan 2020 20:18:41 +0000 (21:18 +0100)
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 <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_osf.c

index f54d6ae15bb18907635f142d2dfe124ca8cd2859..b42247aa48a9e9b1f4e836538ae6558c1a78f3c4 100644 (file)
@@ -61,6 +61,9 @@ static int nft_osf_init(const struct nft_ctx *ctx,
        int err;
        u8 ttl;
 
+       if (!tb[NFTA_OSF_DREG])
+               return -EINVAL;
+
        if (tb[NFTA_OSF_TTL]) {
                ttl = nla_get_u8(tb[NFTA_OSF_TTL]);
                if (ttl > 2)