netfilter: nf_tables: fix a missing check of nla_put_failure
authorKangjie Lu <kjlu@umn.edu>
Fri, 21 Dec 2018 06:46:23 +0000 (00:46 -0600)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 29 Dec 2018 01:44:51 +0000 (02:44 +0100)
If nla_nest_start() may fail. The fix checks its return value and goes
to nla_put_failure if it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index fec814dace5a6e05a397020a4f42c35548f942e2..2b0a93300dd712f24f80567da1548f34b1eff44c 100644 (file)
@@ -5727,6 +5727,8 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net,
                goto nla_put_failure;
 
        nest = nla_nest_start(skb, NFTA_FLOWTABLE_HOOK);
+       if (!nest)
+               goto nla_put_failure;
        if (nla_put_be32(skb, NFTA_FLOWTABLE_HOOK_NUM, htonl(flowtable->hooknum)) ||
            nla_put_be32(skb, NFTA_FLOWTABLE_HOOK_PRIORITY, htonl(flowtable->priority)))
                goto nla_put_failure;