提交 c123bb71 编写于 作者: S Sabrina Dubroca 提交者: Pablo Neira Ayuso

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: ff3cd7b3 ("netfilter: nf_tables: refactor chain statistic routines")
Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 0f9f5e1b
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册