From: Martin Josefsson <gandalf@netfilter.org>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix modify-after-free bug in ip_conntrack
Date: 11 Apr 2003 01:38:15 +0200 [thread overview]
Message-ID: <1050017895.11156.95.camel@tux.rsn.bth.se> (raw)
Hi Dave,
Here's a patch that fixes a modify-after-free bug in ip_conntrack which
was caught by the slab-debugging in 2.5
I've tried to get Harald to approve it and send it to you but I've been
unable to get any response from him for ~2 weeks, so here it is. He can
complain later and provide a diffrent fix if he doesn't like this one.
This patch fixes the case where a related connection terminates after
the connection that expected it has already terminated. In this case the
list_head of the already terminated (and free'd) connection were
modified and we might get invalid pointers in other expectations.
Andrew has had a slightly diffrent fix in -mm during this time. That
patch fixed the modify-after-free but still left invalid pointers in
expectations, this one doesn't.
Please apply to both 2.4 and 2.5
diff -urN linux-2.5.65.orig/net/ipv4/netfilter/ip_conntrack_core.c linux-2.5.65.fixed/net/ipv4/netfilter/ip_conntrack_core.c
--- linux-2.5.65.orig/net/ipv4/netfilter/ip_conntrack_core.c 2003-03-17 22:43:37.000000000 +0100
+++ linux-2.5.65.fixed/net/ipv4/netfilter/ip_conntrack_core.c 2003-04-11 01:07:19.000000000 +0200
@@ -274,6 +274,8 @@
* the un-established ones only */
if (exp->sibling) {
DEBUGP("remove_expectations: skipping established %p of %p\n", exp->sibling, ct);
+ /* Indicate that this expectations parent is dead */
+ exp->expectant = NULL;
continue;
}
@@ -325,6 +327,9 @@
ip_conntrack_destroyed(ct);
WRITE_LOCK(&ip_conntrack_lock);
+ /* Delete us from our own list to prevent corruption later */
+ list_del(&ct->sibling_list);
+
/* Delete our master expectation */
if (ct->master) {
/* can't call __unexpect_related here,
--
/Martin
next reply other threads:[~2003-04-10 23:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-10 23:38 Martin Josefsson [this message]
2003-04-10 23:36 ` David S. Miller
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=1050017895.11156.95.camel@tux.rsn.bth.se \
--to=gandalf@netfilter.org \
--cc=davem@redhat.com \
--cc=gandalf@wlug.westbo.se \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®