netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation

alloc_percpu returns NULL on failure, not a negative error code.

Fixes: ff3cd7b3c9 ("netfilter: nf_tables: refactor chain statistic routines")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Sabrina Dubroca 2014-10-21 11:08:21 +02:00 committed by Pablo Neira Ayuso
parent 0f9f5e1b83
commit c123bb7163
1 changed files with 2 additions and 2 deletions

View File

@ -1328,10 +1328,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
basechain->stats = stats;
} else {
stats = netdev_alloc_pcpu_stats(struct nft_stats);
if (IS_ERR(stats)) {
if (stats == NULL) {
module_put(type->owner);
kfree(basechain);
return PTR_ERR(stats);
return -ENOMEM;
}
rcu_assign_pointer(basechain->stats, stats);
}