sctp: deny peeloff operation on asocs with threads sleeping on it
[pandora-kernel.git] / net / sctp / socket.c
index ccbd6d0..93ea5ac 100644 (file)
@@ -4242,6 +4242,12 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
        struct sctp_af *af;
        int err = 0;
 
        struct sctp_af *af;
        int err = 0;
 
+       /* If there is a thread waiting on more sndbuf space for
+        * sending on this asoc, it cannot be peeled.
+        */
+       if (waitqueue_active(&asoc->wait))
+               return -EBUSY;
+
        /* An association cannot be branched off from an already peeled-off
         * socket, nor is this supported for tcp style sockets.
         */
        /* An association cannot be branched off from an already peeled-off
         * socket, nor is this supported for tcp style sockets.
         */
@@ -6492,8 +6498,6 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
                 */
                sctp_release_sock(sk);
                current_timeo = schedule_timeout(current_timeo);
                 */
                sctp_release_sock(sk);
                current_timeo = schedule_timeout(current_timeo);
-               if (sk != asoc->base.sk)
-                       goto do_error;
                sctp_lock_sock(sk);
 
                *timeo_p = current_timeo;
                sctp_lock_sock(sk);
 
                *timeo_p = current_timeo;