mptcp: avoid race on msk state changes
[linux-2.6-microblaze.git] / net / mptcp / protocol.c
index 6323500..8ead550 100644 (file)
@@ -2946,6 +2946,11 @@ static void mptcp_release_cb(struct sock *sk)
                spin_lock_bh(&sk->sk_lock.slock);
        }
 
+       /* be sure to set the current sk state before tacking actions
+        * depending on sk_state
+        */
+       if (test_and_clear_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->flags))
+               __mptcp_set_connected(sk);
        if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags))
                __mptcp_clean_una_wakeup(sk);
        if (test_and_clear_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags))