提交 7082c5c3 编写于 作者: F Florian Westphal 提交者: David S. Miller

tcp: zero ca_priv area when switching cc algorithms

We need to zero out the private data area when application switches
connection to different algorithm (TCP_CONGESTION setsockopt).

When congestion ops get assigned at connect time everything is already
zeroed because sk_alloc uses GFP_ZERO flag.  But in the setsockopt case
this contains whatever previous cc placed there.
Signed-off-by: NFlorian Westphal <fw@strlen.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7c6ae610
...@@ -200,8 +200,10 @@ static void tcp_reinit_congestion_control(struct sock *sk, ...@@ -200,8 +200,10 @@ static void tcp_reinit_congestion_control(struct sock *sk,
icsk->icsk_ca_ops = ca; icsk->icsk_ca_ops = ca;
icsk->icsk_ca_setsockopt = 1; icsk->icsk_ca_setsockopt = 1;
if (sk->sk_state != TCP_CLOSE) if (sk->sk_state != TCP_CLOSE) {
memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv));
tcp_init_congestion_control(sk); tcp_init_congestion_control(sk);
}
} }
/* Manage refcounts on socket close. */ /* Manage refcounts on socket close. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册