summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSrinivas Aji <Aji_Srinivas@emc.com>2007-05-23 00:54:10 +0200
committerAdrian Bunk <bunk@stusta.de>2007-05-23 00:54:10 +0200
commitbba669f7618ba72c6b17faed7c6ca6c6bec8cb72 (patch)
treec9bfd26b6fae25fb1cfc484964ae7d34246f3e19 /net
parent00fd81fe55fbf464a952a43fd4dc3248601a5f87 (diff)
downloadlinux-rt-bba669f7618ba72c6b17faed7c6ca6c6bec8cb72.tar.gz
[TCP]: zero out rx_opt in tcp_disconnect()
When the server drops its connection, NFS client reconnects using the same socket after disconnecting. If the new connection's SYN,ACK doesn't contain the TCP timestamp option and the old connection's did, tp->tcp_header_len is recomputed assuming no timestamp header but tp->rx_opt.tstamp_ok remains set. Then tcp_build_and_update_options() adds in a timestamp option past the end of the allocated TCP header, overwriting TCP data, or when the data is in skb_shinfo(skb)->frags[], overwriting skb_shinfo(skb) causing a crash soon after. (The issue was debugged from such a crash.) Similarly, wscale_ok and sack_ok also get set based on the SYN,ACK packet but not reset on disconnect, since they are zeroed out at initialization. The patch zeroes out the entire tp->rx_opt struct in tcp_disconnect() to avoid this sort of problem. Signed-off-by: Srinivas Aji <Aji_Srinivas@emc.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f33e1c61616a..5bca5b064d4c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1674,8 +1674,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_clear_retrans(tp);
inet_csk_delack_init(sk);
sk->sk_send_head = NULL;
- tp->rx_opt.saw_tstamp = 0;
- tcp_sack_reset(&tp->rx_opt);
+ memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
__sk_dst_reset(sk);
BUG_TRAP(!inet->num || icsk->icsk_bind_hash);