Skip to content

Commit

Permalink
netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats…
Browse files Browse the repository at this point in the history
… allocation

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

Fixes: ff3cd7b ("netfilter: nf_tables: refactor chain statistic routines")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Sabrina Dubroca authored and Pablo Neira Ayuso committed Oct 22, 2014
1 parent 0f9f5e1 commit c123bb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c123bb7

Please sign in to comment.