Skip to content

Commit

Permalink
netfilter: nf_tables: don't update chain with unset counters
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pablo Neira Ayuso committed Aug 8, 2014
1 parent a3716e7 commit b88825d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b88825d

Please sign in to comment.