All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't increase master refcount on expectations
@ 2005-08-25 20:45 Pablo Neira
  2005-08-26 12:33 ` JessePeng
  2005-09-04 17:47 ` Patrick McHardy
  0 siblings, 2 replies; 6+ messages in thread
From: Pablo Neira @ 2005-08-25 20:45 UTC (permalink / raw)
  To: Netfilter Development Mailinglist
  Cc: Harald Welte, Patrick McHardy, Yasuyuki Kozakai

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

As it's been discussed [1][2]. We shouldn't increase the master 
conntrack refcount for non-fulfilled conntracks. During the conntrack 
destruction, the expectations are always killed before the conntrack 
itself, this guarantees that there won't be any orphan expectation.

[1]https://lists.netfilter.org/pipermail/netfilter-devel/2005-August/020783.html
[2]https://lists.netfilter.org/pipermail/netfilter-devel/2005-August/020904.html

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

[-- Attachment #2: 06expect-refcount.patch --]
[-- Type: text/x-patch, Size: 1167 bytes --]

Index: netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_core.c
===================================================================
--- netfilter-2.6.14.orig/net/ipv4/netfilter/ip_conntrack_core.c	2005-08-20 18:19:44.000000000 +0200
+++ netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_core.c	2005-08-20 18:27:59.000000000 +0200
@@ -934,6 +934,9 @@
 	write_unlock_bh(&ip_conntrack_lock);
 }
 
+/* We don't increase the master conntrack refcount for non-fulfilled
+ * conntracks. During the conntrack destruction, the expectations are 
+ * always killed before the conntrack itself */
 struct ip_conntrack_expect *ip_conntrack_expect_alloc(struct ip_conntrack *me)
 {
 	struct ip_conntrack_expect *new;
@@ -944,17 +947,14 @@
 		return NULL;
 	}
 	new->master = me;
-	atomic_inc(&new->master->ct_general.use);
 	atomic_set(&new->use, 1);
 	return new;
 }
 
 void ip_conntrack_expect_put(struct ip_conntrack_expect *exp)
 {
-	if (atomic_dec_and_test(&exp->use)) {
-		ip_conntrack_put(exp->master);
+	if (atomic_dec_and_test(&exp->use))
 		kmem_cache_free(ip_conntrack_expect_cachep, exp);
-	}
 }
 
 static void ip_conntrack_expect_insert(struct ip_conntrack_expect *exp)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-09-11 22:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-25 20:45 [PATCH] Don't increase master refcount on expectations Pablo Neira
2005-08-26 12:33 ` JessePeng
2005-09-07  5:01   ` Yasuyuki KOZAKAI
2005-09-11 22:38     ` Jesse Peng
2005-09-04 17:47 ` Patrick McHardy
2005-09-07  2:00   ` Yasuyuki KOZAKAI

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.