Skip to contentSkip to conversation

locking fix for TCP conntrack

PATCH Applied Harald Welte 3 participants 3 messages Jan 9, 2003 – Jan 10, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locking fix for TCP conntrack

Hi Dave!

This is another patch of the series of patches you will receive from me today.

Please apply to 2.4.x and 2.5.x, thanks.

Author: Martin Josefsson <[email protected]>
Fix a locking bug in ip_conntrack_proto_tcp.

net/ipv4/netfilter/ip_conntrack_proto_tcp.c renamed from net/ipv4/netfilter/ip_conntrack_proto_tcp.c.meep +2 -1
@@ -186,13 +186,13 @@
 	    && tcph->syn && tcph->ack)
 		conntrack->proto.tcp.handshake_ack
 			= htonl(ntohl(tcph->seq) + 1);
-	WRITE_UNLOCK(&tcp_lock);
 
 	/* If only reply is a RST, we can consider ourselves not to
 	   have an established connection: this is a fairly common
 	   problem case, so we can delete the conntrack
 	   immediately.  --RR */
 	if (!(conntrack->status & IPS_SEEN_REPLY) && tcph->rst) {
+		WRITE_UNLOCK(&tcp_lock);
 		if (del_timer(&conntrack->timeout))
 			conntrack->timeout.function((unsigned long)conntrack);
 	} else {
@@ -203,6 +203,7 @@
 		    && tcph->ack_seq == conntrack->proto.tcp.handshake_ack)
 			set_bit(IPS_ASSURED_BIT, &conntrack->status);
 
+		WRITE_UNLOCK(&tcp_lock);
 		ip_ct_refresh(conntrack, tcp_timeouts[newconntrack]);
 	}
 
Signature · 4 lines
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#2 lore raw

unscribe

unscribe