* [NETFILTER 6/8]: Don't increase master refcount on expectations
@ 2005-09-06 17:55 Patrick McHardy
0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2005-09-06 17:55 UTC (permalink / raw)
To: David S. Miller; +Cc: Netfilter Development Mailinglist
[-- Attachment #1: 06.diff --]
[-- Type: text/x-patch, Size: 2114 bytes --]
[NETFILTER]: Don't increase master refcount on expectations
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>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 0cec535bc739cac6e928db1c5e178b6a3f72f241
tree 12979d31aecd39078a0c707cf810e15f7d87f222
parent 917240fdfb4a326d7488803be075e60e9fda6a3e
author Pablo Neira Ayuso <pablo@netfilter.org> Sun, 04 Sep 2005 19:46:35 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 04 Sep 2005 19:46:35 +0200
net/ipv4/netfilter/ip_conntrack_core.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -938,6 +938,9 @@ void ip_conntrack_unexpect_related(struc
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;
@@ -948,17 +951,14 @@ struct ip_conntrack_expect *ip_conntrack
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] only message in thread
only message in thread, other threads:[~2005-09-06 17:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-06 17:55 [NETFILTER 6/8]: Don't increase master refcount on expectations Patrick McHardy
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.