Commit dc7cf779 authored by Martin Josefsson's avatar Martin Josefsson Committed by David S. Miller

[NETFILTER]: Fix a locking bug in ip_conntrack_proto_tcp.

parent 9efdba05
...@@ -186,13 +186,13 @@ static int tcp_packet(struct ip_conntrack *conntrack, ...@@ -186,13 +186,13 @@ static int tcp_packet(struct ip_conntrack *conntrack,
&& tcph->syn && tcph->ack) && tcph->syn && tcph->ack)
conntrack->proto.tcp.handshake_ack conntrack->proto.tcp.handshake_ack
= htonl(ntohl(tcph->seq) + 1); = htonl(ntohl(tcph->seq) + 1);
WRITE_UNLOCK(&tcp_lock);
/* If only reply is a RST, we can consider ourselves not to /* If only reply is a RST, we can consider ourselves not to
have an established connection: this is a fairly common have an established connection: this is a fairly common
problem case, so we can delete the conntrack problem case, so we can delete the conntrack
immediately. --RR */ immediately. --RR */
if (!(conntrack->status & IPS_SEEN_REPLY) && tcph->rst) { if (!(conntrack->status & IPS_SEEN_REPLY) && tcph->rst) {
WRITE_UNLOCK(&tcp_lock);
if (del_timer(&conntrack->timeout)) if (del_timer(&conntrack->timeout))
conntrack->timeout.function((unsigned long)conntrack); conntrack->timeout.function((unsigned long)conntrack);
} else { } else {
...@@ -203,6 +203,7 @@ static int tcp_packet(struct ip_conntrack *conntrack, ...@@ -203,6 +203,7 @@ static int tcp_packet(struct ip_conntrack *conntrack,
&& tcph->ack_seq == conntrack->proto.tcp.handshake_ack) && tcph->ack_seq == conntrack->proto.tcp.handshake_ack)
set_bit(IPS_ASSURED_BIT, &conntrack->status); set_bit(IPS_ASSURED_BIT, &conntrack->status);
WRITE_UNLOCK(&tcp_lock);
ip_ct_refresh(conntrack, tcp_timeouts[newconntrack]); ip_ct_refresh(conntrack, tcp_timeouts[newconntrack]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment