Commit a9ac5b0b authored by Eric Dumazet's avatar Eric Dumazet Committed by Greg Kroah-Hartman

net-tcp: fix panic in tcp_fastopen_cache_set()

[ Upstream commit dccf76ca ]

We had some reports of crashes using TCP fastopen, and Dave Jones
gave a nice stack trace pointing to the error.

Issue is that tcp_get_metrics() should not be called with a NULL dst

Fixes: 1fe4c481 ("net-tcp: Fast Open client - cookie cache")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarDave Jones <davej@redhat.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: default avatarYuchung Cheng <ycheng@google.com>
Tested-by: default avatarDave Jones <davej@fedoraproject.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent accbc62e
...@@ -659,10 +659,13 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, ...@@ -659,10 +659,13 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
void tcp_fastopen_cache_set(struct sock *sk, u16 mss, void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
struct tcp_fastopen_cookie *cookie, bool syn_lost) struct tcp_fastopen_cookie *cookie, bool syn_lost)
{ {
struct dst_entry *dst = __sk_dst_get(sk);
struct tcp_metrics_block *tm; struct tcp_metrics_block *tm;
if (!dst)
return;
rcu_read_lock(); rcu_read_lock();
tm = tcp_get_metrics(sk, __sk_dst_get(sk), true); tm = tcp_get_metrics(sk, dst, true);
if (tm) { if (tm) {
struct tcp_fastopen_metrics *tfom = &tm->tcpm_fastopen; struct tcp_fastopen_metrics *tfom = &tm->tcpm_fastopen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment