Skip to content

Commit

Permalink
netfilter: nf_tables: fix wrong transaction ordering in set elements
Browse files Browse the repository at this point in the history
The transaction needs to be placed at the end of the commit list,
otherwise event notifications are reordered and we may crash when
releasing object via call_rcu.

This problem was introduced in 60319eb ("netfilter: nf_tables: use new
transaction infrastructure to handle elements").

Reported-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Jun 2, 2014
1 parent 4c552a6 commit 46bbafc
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
@@ -3077,7 +3077,7 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
goto err4;

nft_trans_elem(trans) = elem;
list_add(&trans->list, &ctx->net->nft.commit_list);
list_add_tail(&trans->list, &ctx->net->nft.commit_list);
return 0;

err4:
@@ -3161,7 +3161,7 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,
goto err2;

nft_trans_elem(trans) = elem;
list_add(&trans->list, &ctx->net->nft.commit_list);
list_add_tail(&trans->list, &ctx->net->nft.commit_list);

nft_data_uninit(&elem.key, NFT_DATA_VALUE);
if (set->flags & NFT_SET_MAP)

0 comments on commit 46bbafc

Please sign in to comment.