From: Neil Horman <nhorman@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: wensong@linux-vs.org, ja@ssi.bg, nhorman@redhat.com, akpm@osdl.org
Subject: [Patch] ipvs: close race conditions on ip_vs_conn_tab list modification
Date: Thu, 23 Jun 2005 14:39:26 -0400 [thread overview]
Message-ID: <20050623183926.GI16783@hmsendeavour.rdu.redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]
Hello there-
Patch to close a race condition in ip_vs_conn_flush. In an smp system,
it is possible for an connection timer to expire, calling ip_vs_conn_expire
while the connection table is being flushed, before ct_write_lock_bh is
acquired. Since the list iterator loop in ip_vs_con_flush releases and
re-acquires the spinlock (even though it doesn't re-enable softirqs), it is
possible for the expiration function to modify the connection list, while it is
being traversed in ip_vs_conn_flush. The result is that the next pointer gets
set to NULL, and subsequently dereferenced, resulting in an oops. This patch
removes the lock release and re-aquisition from the loop, closing the race
window. Tested by myself, and those who origionally experienced the crash and
reported it to me, with successful results.
Signed-off-by: Neil Horman <nhorman@redhat.com>
ip_vs_conn.c | 2 --
1 files changed, 2 deletions(-)
--- linux-2.6.git/net/ipv4/ipvs/ip_vs_conn.c.orig 2005-06-23 13:11:00.910372471 -0400
+++ linux-2.6.git/net/ipv4/ipvs/ip_vs_conn.c 2005-06-23 13:15:54.459852393 -0400
@@ -840,7 +838,6 @@
list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) {
atomic_inc(&cp->refcnt);
- ct_write_unlock(idx);
if ((ct = cp->control))
atomic_inc(&ct->refcnt);
@@ -850,7 +847,6 @@
IP_VS_DBG(4, "del conn template\n");
ip_vs_conn_expire_now(ct);
}
- ct_write_lock(idx);
}
ct_write_unlock_bh(idx);
}
--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc.
*nhorman@redhat.com
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu
***************************************************/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-06-23 18:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-23 18:39 Neil Horman [this message]
2005-06-24 8:46 ` Julian Anastasov
2005-06-24 14:48 ` Neil Horman
2005-06-24 15:09 ` Julian Anastasov
2005-06-24 17:40 ` Neil Horman
2005-06-26 17:05 ` Wensong Zhang
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=20050623183926.GI16783@hmsendeavour.rdu.redhat.com \
--to=nhorman@redhat.com \
--cc=akpm@osdl.org \
--cc=ja@ssi.bg \
--cc=linux-kernel@vger.kernel.org \
--cc=wensong@linux-vs.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®