All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira <pablo@eurodev.net>
To: Patrick McHardy <kaber@trash.net>
Cc: Harald Welte <laforge@netfilter.org>,
	Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH 1/7] Fix expectation leak
Date: Tue, 02 Aug 2005 14:39:58 +0200	[thread overview]
Message-ID: <42EF699E.9060901@eurodev.net> (raw)
In-Reply-To: <42EE7D92.5020401@trash.net>

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

Patrick McHardy wrote:
> Pablo Neira wrote:
> 
>>Yes, but the refcount is incremented twice ;). Please apply.
> 
> There is one reference for the list and one for the timer. Both are
> needed since the timer deletion can race with the timer. The one
> for the list is dropped in __ip_ct_expect_unlink_destroy, the one
> for the timer after it has been successfully removed.

OK, in that case the following patch should fix the hung that I'm 
experimenting while trying to remove ip_conntrack. It happens if there's 
an expectation pending to be confirmed. It seems that we forgot to drop 
the refcount when removing a conntrack the list, unlink_expect doesn't 
actually do it. So, in this case the correct call must be 
__ip_conntrack_expect_unlink_destroy instead of unlink_expect.

--
Pablo

[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1477 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-02 12:47:39.000000000 +0200
+++ netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_core.c	2005-08-02 14:28:01.000000000 +0200
@@ -294,7 +294,7 @@
 
 	list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) {
 		if (i->master == ct && del_timer(&i->timeout)) {
-			unlink_expect(i);
+			__ip_ct_expect_unlink_destroy(i);
 			ip_conntrack_expect_put(i);
 		}
 	}
@@ -936,7 +936,7 @@
 	/* choose the the oldest expectation to evict */
 	list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
 		if (expect_matches(i, exp) && del_timer(&i->timeout)) {
-			unlink_expect(i);
+			__ip_ct_expect_unlink_destroy(i);
 			write_unlock_bh(&ip_conntrack_lock);
 			ip_conntrack_expect_put(i);
 			return;
@@ -993,7 +993,7 @@
 	list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
 		if (i->master == master) {
 			if (del_timer(&i->timeout)) {
-				unlink_expect(i);
+				__ip_ct_expect_unlink_destroy(i);
 				ip_conntrack_expect_put(i);
 			}
 			break;
@@ -1110,7 +1110,7 @@
 	/* Get rid of expectations */
 	list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) {
 		if (exp->master->helper == me && del_timer(&exp->timeout)) {
-			unlink_expect(exp);
+			__ip_ct_expect_unlink_destroy(exp);
 			ip_conntrack_expect_put(exp);
 		}
 	}

  reply	other threads:[~2005-08-02 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-01 17:04 [PATCH 1/7] Fix expectation leak Pablo Neira
2005-08-01 17:12 ` Patrick McHardy
     [not found]   ` <42EE5EC4.5090303@eurodev.net>
2005-08-01 19:52     ` Patrick McHardy
2005-08-02 12:39       ` Pablo Neira [this message]
2005-08-02 21:45         ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42EF699E.9060901@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=kaber@trash.net \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.