summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_cong.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-11-21 10:08:37 +0100
committerDavid S. Miller <davem@davemloft.net>2016-11-21 13:13:56 -0500
commit7082c5c3f2407c52022507ffaf644dbbab97a883 (patch)
tree11b22cf7efa89d4ee5f657f451616340bd290a31 /net/ipv4/tcp_cong.c
parent7c6ae610a1f0a9d3cebf790e0245b4e0f76aa86e (diff)
downloadlinux-7082c5c3f2407c52022507ffaf644dbbab97a883.tar.gz
linux-7082c5c3f2407c52022507ffaf644dbbab97a883.tar.xz
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: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_cong.c')
-rw-r--r--net/ipv4/tcp_cong.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 1294af4e0127..f9038d6b109e 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -200,8 +200,10 @@ static void tcp_reinit_congestion_control(struct sock *sk,
icsk->icsk_ca_ops = ca;
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);
+ }
}
/* Manage refcounts on socket close. */