Patchwork [1/2] netfilter: nf_tables: attach replacement rule after stale one

login
register
mail settings
Submitter Pablo Neira
Date Sept. 17, 2013, 10:14 p.m.
Message ID <1379456095-4070-1-git-send-email-pablo@netfilter.org>
Download mbox | patch
Permalink /patch/275561/
State Accepted
Headers show

Comments

Pablo Neira - Sept. 17, 2013, 10:14 p.m.
Insert the new rule after the existing stale one that
will be removed in the commit phase.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 755d596..0e55e1b 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1659,7 +1659,8 @@  static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb,
 		rupd = nf_tables_trans_add(old_rule, &ctx);
 		if (rupd == NULL)
 			goto err2;
-		list_add_tail_rcu(&rule->list, &chain->rules);
+
+		list_add_tail(&rule->list, &old_rule->list);
 	} else if (nlh->nlmsg_flags & NLM_F_APPEND)
 		if (old_rule)
 			list_add_rcu(&rule->list, &old_rule->list);