Skip to content

Commit

Permalink
Bluetooth: l2cap: Fix lost wakeup waiting for ERTM acks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Hurley authored and Gustavo F. Padovan committed Aug 11, 2011
1 parent 3a3f5c7 commit a71a0cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit a71a0cf

Please sign in to comment.