Skip to content

Commit

Permalink
Bluetooth: fix shutdown on SCO sockets
Browse files Browse the repository at this point in the history
shutdown should wait for SCO link to be properly disconnected before
detroying the socket, otherwise an application using the socket may
assume link is properly disconnected before it really happens which
can be a problem when e.g synchronizing profile switch.

Signed-off-by: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Luiz Augusto von Dentz authored and Gustavo F. Padovan committed Apr 18, 2011
1 parent b79f44c commit f21ca5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@ static void __sco_sock_close(struct sock *sk)

case BT_CONNECTED:
case BT_CONFIG:
if (sco_pi(sk)->conn) {
sk->sk_state = BT_DISCONN;
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
hci_conn_put(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn = NULL;
} else
sco_chan_del(sk, ECONNRESET);
break;

case BT_CONNECT:
case BT_DISCONN:
sco_chan_del(sk, ECONNRESET);
Expand Down

0 comments on commit f21ca5f

Please sign in to comment.