Skip to content

Commit

Permalink
netfilter: nf_tables: fix error handling of rule replacement
Browse files Browse the repository at this point in the history
In general, if a transaction object is added to the list successfully,
we can rely on the abort path to undo what we've done. This allows us to
simplify the error handling of the rule replacement path in
nf_tables_newrule().

This implicitly fixes an unnecessary removal of the old rule, which
needs to be left in place if we fail to replace.

Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
ummakynes committed Mar 4, 2015
1 parent 86f1ec3 commit 59900e0
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2045,12 +2045,6 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb,

err3:
list_del_rcu(&rule->list);
if (trans) {
list_del_rcu(&nft_trans_rule(trans)->list);
nft_rule_clear(net, nft_trans_rule(trans));
nft_trans_destroy(trans);
chain->use++;
}
err2:
nf_tables_rule_destroy(&ctx, rule);
err1:
Expand Down

0 comments on commit 59900e0

Please sign in to comment.