diff options
-rw-r--r-- | net/ipv4/af_inet.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 7 | ||||
-rw-r--r-- | net/ipv4/tcp_fastopen.c | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 8b47a4d79d04..a5aa54ea6533 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -228,6 +228,8 @@ int inet_listen(struct socket *sock, int backlog) | |||
228 | err = 0; | 228 | err = 0; |
229 | if (err) | 229 | if (err) |
230 | goto out; | 230 | goto out; |
231 | |||
232 | tcp_fastopen_init_key_once(true); | ||
231 | } | 233 | } |
232 | err = inet_csk_listen_start(sk, backlog); | 234 | err = inet_csk_listen_start(sk, backlog); |
233 | if (err) | 235 | if (err) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f1377f2a0472..bb2ce74f6004 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2545,10 +2545,13 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2545 | 2545 | ||
2546 | case TCP_FASTOPEN: | 2546 | case TCP_FASTOPEN: |
2547 | if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE | | 2547 | if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE | |
2548 | TCPF_LISTEN))) | 2548 | TCPF_LISTEN))) { |
2549 | tcp_fastopen_init_key_once(true); | ||
2550 | |||
2549 | err = fastopen_init_queue(sk, val); | 2551 | err = fastopen_init_queue(sk, val); |
2550 | else | 2552 | } else { |
2551 | err = -EINVAL; | 2553 | err = -EINVAL; |
2554 | } | ||
2552 | break; | 2555 | break; |
2553 | case TCP_TIMESTAMP: | 2556 | case TCP_TIMESTAMP: |
2554 | if (!tp->repair) | 2557 | if (!tp->repair) |
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 46b087a27503..f9c0fb84e435 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -78,8 +78,6 @@ static bool __tcp_fastopen_cookie_gen(const void *path, | |||
78 | struct tcp_fastopen_context *ctx; | 78 | struct tcp_fastopen_context *ctx; |
79 | bool ok = false; | 79 | bool ok = false; |
80 | 80 | ||
81 | tcp_fastopen_init_key_once(true); | ||
82 | |||
83 | rcu_read_lock(); | 81 | rcu_read_lock(); |
84 | ctx = rcu_dereference(tcp_fastopen_ctx); | 82 | ctx = rcu_dereference(tcp_fastopen_ctx); |
85 | if (ctx) { | 83 | if (ctx) { |