Skip to contentSkip to conversation

netfilter: nf_tables: fix basechain release

PATCH New Pablo Neira Ayuso 1 participant 1 message Sep 24, 2013

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: fix basechain release

Base chains are containers of the chain object, kfree was receiving the wrong memory address in that case.

---
 net/netfilter/nf_tables_api.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nf_tables_api.c +4 -3
index 91cba3b..f2d7f93 100644
@@ -1004,10 +1004,11 @@ static void nf_tables_rcu_chain_destroy(struct rcu_head *head)
 
 	BUG_ON(chain->use > 0);
 
-	if (chain->flags & NFT_BASE_CHAIN)
+	if (chain->flags & NFT_BASE_CHAIN) {
 		free_percpu(nft_base_chain(chain)->stats);
-
-	kfree(chain);
+		kfree(nft_base_chain(chain));
+	} else
+		kfree(chain);
 }
 
 static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb,
Signature · 1 line
1.7.10.4