]> Pileus Git - ~andy/linux/commit
tcp: Reject invalid ack_seq to Fast Open sockets
authorJerry Chu <hkchu@google.com>
Mon, 22 Oct 2012 11:26:36 +0000 (11:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Oct 2012 06:42:56 +0000 (02:42 -0400)
commit37561f68bd527ec39076e32effdc7b1dcdfb17ea
tree3b15ff453617ee5ef52e5f7a9885770b4172bc0a
parent0b63bf1fe6f9ed1ec4148e8896f4522e08476b80
tcp: Reject invalid ack_seq to Fast Open sockets

A packet with an invalid ack_seq may cause a TCP Fast Open socket to switch
to the unexpected TCP_CLOSING state, triggering a BUG_ON kernel panic.

When a FIN packet with an invalid ack_seq# arrives at a socket in
the TCP_FIN_WAIT1 state, rather than discarding the packet, the current
code will accept the FIN, causing state transition to TCP_CLOSING.

This may be a small deviation from RFC793, which seems to say that the
packet should be dropped. Unfortunately I did not expect this case for
Fast Open hence it will trigger a BUG_ON panic.

It turns out there is really nothing bad about a TFO socket going into
TCP_CLOSING state so I could just remove the BUG_ON statements. But after
some thought I think it's better to treat this case like TCP_SYN_RECV
and return a RST to the confused peer who caused the unacceptable ack_seq
to be generated in the first place.

Signed-off-by: H.K. Jerry Chu <hkchu@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c
net/ipv4/tcp_timer.c