]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/tcp_metrics.c
net-tcp: fix panic in tcp_fastopen_cache_set()
[~andy/linux] / net / ipv4 / tcp_metrics.c
index 2ab09cbae74d29155d08f7dd701851136d205e0f..d3ee2e0c28b6c0dcbfe93445563ee53e3ce52431 100644 (file)
@@ -663,10 +663,13 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
 void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
                            struct tcp_fastopen_cookie *cookie, bool syn_lost)
 {
+       struct dst_entry *dst = __sk_dst_get(sk);
        struct tcp_metrics_block *tm;
 
+       if (!dst)
+               return;
        rcu_read_lock();
-       tm = tcp_get_metrics(sk, __sk_dst_get(sk), true);
+       tm = tcp_get_metrics(sk, dst, true);
        if (tm) {
                struct tcp_fastopen_metrics *tfom = &tm->tcpm_fastopen;