tcp_scalable: Update malformed & dead url
[sfrench/cifs-2.6.git] / net / sctp / input.c
index bf612d954d413fd46ccc489202f8014b5b2ae556..2e4a8646dbc389dcb55fcce1cf6b3ad0f608af0d 100644 (file)
@@ -249,6 +249,19 @@ int sctp_rcv(struct sk_buff *skb)
         */
        sctp_bh_lock_sock(sk);
 
+       if (sk != rcvr->sk) {
+               /* Our cached sk is different from the rcvr->sk.  This is
+                * because migrate()/accept() may have moved the association
+                * to a new socket and released all the sockets.  So now we
+                * are holding a lock on the old socket while the user may
+                * be doing something with the new socket.  Switch our veiw
+                * of the current sk.
+                */
+               sctp_bh_unlock_sock(sk);
+               sk = rcvr->sk;
+               sctp_bh_lock_sock(sk);
+       }
+
        if (sock_owned_by_user(sk)) {
                SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG);
                sctp_add_backlog(sk, skb);