Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c123bb71 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by Pablo Neira Ayuso
Browse files

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: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 0f9f5e1b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
		}