Commit a71a0cf4 authored by Peter Hurley's avatar Peter Hurley Committed by Gustavo F. Padovan

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: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 3a3f5c7d
...@@ -1159,9 +1159,8 @@ int __l2cap_wait_ack(struct sock *sk) ...@@ -1159,9 +1159,8 @@ int __l2cap_wait_ack(struct sock *sk)
int timeo = HZ/5; int timeo = HZ/5;
add_wait_queue(sk_sleep(sk), &wait); 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) if (!timeo)
timeo = HZ/5; timeo = HZ/5;
...@@ -1173,6 +1172,7 @@ int __l2cap_wait_ack(struct sock *sk) ...@@ -1173,6 +1172,7 @@ int __l2cap_wait_ack(struct sock *sk)
release_sock(sk); release_sock(sk);
timeo = schedule_timeout(timeo); timeo = schedule_timeout(timeo);
lock_sock(sk); lock_sock(sk);
set_current_state(TASK_INTERRUPTIBLE);
err = sock_error(sk); err = sock_error(sk);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment