]> git.neil.brown.name Git - history.git/commitdiff
[NETFILTER]: Fix a locking bug in ip_conntrack_proto_tcp.
authorMartin Josefsson <gandalf@wlug.westbo.se>
Thu, 9 Jan 2003 16:51:25 +0000 (08:51 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Thu, 9 Jan 2003 16:51:25 +0000 (08:51 -0800)
net/ipv4/netfilter/ip_conntrack_proto_tcp.c

index 5577fe1843d915c07d4279acb62eacea7c0e2096..01c56b8d54f039ebd6d94ebfbb8e17bbc21a4f4d 100644 (file)
@@ -186,13 +186,13 @@ static int tcp_packet(struct ip_conntrack *conntrack,
            && 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 @@ static int tcp_packet(struct ip_conntrack *conntrack,
                    && 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]);
        }