* [PATCH net] tcp: zero ca_priv area when switching cc algorithms
@ 2016-11-21 9:08 Florian Westphal
2016-11-21 18:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2016-11-21 9:08 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
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>
---
net/ipv4/tcp_cong.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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. */
--
2.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] tcp: zero ca_priv area when switching cc algorithms
2016-11-21 9:08 [PATCH net] tcp: zero ca_priv area when switching cc algorithms Florian Westphal
@ 2016-11-21 18:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-11-21 18:14 UTC (permalink / raw)
To: fw; +Cc: netdev
From: Florian Westphal <fw@strlen.de>
Date: Mon, 21 Nov 2016 10:08:37 +0100
> 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>
Good catch, applied, thanks Florian.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-21 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 9:08 [PATCH net] tcp: zero ca_priv area when switching cc algorithms Florian Westphal
2016-11-21 18:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).