From: Peter Hurley Date: Mon, 25 Jul 2011 22:36:26 +0000 (-0400) Subject: Bluetooth: l2cap: Fix lost wakeup waiting for ERTM acks X-Git-Tag: firefly_0821_release~7613^2~381 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b0ebe79d6616fbd5a1fe8f08b5a6ba5d38d19841;p=firefly-linux-kernel-4.4.55.git Bluetooth: l2cap: Fix lost wakeup waiting for ERTM acks Fix race condition which can result in missing wakeup during l2cap socket shutdown. Signed-off-by: Peter Hurley Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ed602042a95e..5a0ce738751e 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1159,9 +1159,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; @@ -1173,6 +1172,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)