]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
netfilter: nf_tables: fix error handling of rule replacement
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Mar 2015 16:55:27 +0000 (17:55 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Mar 2015 17:46:08 +0000 (18:46 +0100)
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 <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 74e4b876c96ef3aa4bf48a83be06f23daf1a904d..6ab777912237976ed72cdd34f18a7bea336f44ae 100644 (file)
@@ -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: