提交 b40b4f79 编写于 作者: S Srinivas Aji 提交者: David S. Miller

[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: NSrinivas Aji <Aji_Srinivas@emc.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fde82055
...@@ -1760,8 +1760,7 @@ int tcp_disconnect(struct sock *sk, int flags) ...@@ -1760,8 +1760,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_clear_retrans(tp); tcp_clear_retrans(tp);
inet_csk_delack_init(sk); inet_csk_delack_init(sk);
tcp_init_send_head(sk); tcp_init_send_head(sk);
tp->rx_opt.saw_tstamp = 0; memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
tcp_sack_reset(&tp->rx_opt);
__sk_dst_reset(sk); __sk_dst_reset(sk);
BUG_TRAP(!inet->num || icsk->icsk_bind_hash); BUG_TRAP(!inet->num || icsk->icsk_bind_hash);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册