]> git.hungrycats.org Git - linux/commitdiff
netfilter: nf_tables: don't update chain with unset counters
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 5 Aug 2014 15:25:59 +0000 (17:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 20:41:11 +0000 (13:41 -0700)
commit b88825de8545ad252c31543fef13cadf4de7a2bc upstream.

Fix possible replacement of the per-cpu chain counters by null
pointer when updating an existing chain in the commit path.

Reported-by: Matteo Croce <technoboy85@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_tables_api.c

index 8746ff9a83571d97b3991dced7ad3f968c15bdfa..62101ed0d2aff7afcb7b5b39b6b207e0b1cc2f2b 100644 (file)
@@ -899,6 +899,9 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
 static void nft_chain_stats_replace(struct nft_base_chain *chain,
                                    struct nft_stats __percpu *newstats)
 {
+       if (newstats == NULL)
+               return;
+
        if (chain->stats) {
                struct nft_stats __percpu *oldstats =
                                nft_dereference(chain->stats);