Already another one fix I overlooked.

Signed-off-by: Hannes Frederic Sowa <han...@stressinduktion.org>
---
 net/ipv4/tcp_metrics.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 33a36648423e8b..196de79902819a 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -367,7 +367,7 @@ static struct tcp_metrics_block *tcp_get_metrics(struct 
sock *sk,
 void tcp_update_metrics(struct sock *sk)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
-       struct dst_entry *dst = __sk_dst_get(sk);
+       struct dst_entry *dst;
        struct tcp_sock *tp = tcp_sk(sk);
        struct net *net = sock_net(sk);
        struct tcp_metrics_block *tm;
@@ -375,13 +375,14 @@ void tcp_update_metrics(struct sock *sk)
        u32 val;
        int m;
 
+       rcu_read_lock();
+       dst = __sk_dst_get(sk);
        if (sysctl_tcp_nometrics_save || !dst)
-               return;
+               goto out_unlock;
 
        if (dst->flags & DST_HOST)
                dst_confirm(dst);
 
-       rcu_read_lock();
        if (icsk->icsk_backoff || !tp->srtt_us) {
                /* This session failed to estimate rtt. Why?
                 * Probably, no packets returned in time.  Reset our
-- 
2.5.5

Reply via email to