]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Bluetooth: l2cap: Fix lost wakeup waiting for ERTM acks
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 25 Jul 2011 22:36:26 +0000 (18:36 -0400)
committerGustavo F. Padovan <padovan@profusion.mobi>
Mon, 1 Aug 2011 17:56:55 +0000 (14:56 -0300)
Fix race condition which can result in missing wakeup during
l2cap socket shutdown.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
net/bluetooth/l2cap_core.c

index 0045b1ece14c2150635368a51dd391b3ca1d04b1..72bae1d1158f6138b3079c5b5a7ce154d0223cd7 100644 (file)
@@ -1158,9 +1158,8 @@ int __l2cap_wait_ack(struct sock *sk)
        int timeo = HZ/5;
 
        add_wait_queue(sk_sleep(sk), &wait);
-       while ((chan->unacked_frames > 0 && chan->conn)) {
-               set_current_state(TASK_INTERRUPTIBLE);
-
+       set_current_state(TASK_INTERRUPTIBLE);
+       while (chan->unacked_frames > 0 && chan->conn) {
                if (!timeo)
                        timeo = HZ/5;
 
@@ -1172,6 +1171,7 @@ int __l2cap_wait_ack(struct sock *sk)
                release_sock(sk);
                timeo = schedule_timeout(timeo);
                lock_sock(sk);
+               set_current_state(TASK_INTERRUPTIBLE);
 
                err = sock_error(sk);
                if (err)