Skip to content

Commit f21ca5f

Browse files
Luiz Augusto von DentzGustavo F. Padovan
authored andcommitted
Bluetooth: fix shutdown on SCO sockets
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>
1 parent b79f44c commit f21ca5f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎net/bluetooth/sco.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ static void __sco_sock_close(struct sock *sk)
369369

370370
case BT_CONNECTED:
371371
case BT_CONFIG:
372+
if (sco_pi(sk)->conn) {
373+
sk->sk_state = BT_DISCONN;
374+
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
375+
hci_conn_put(sco_pi(sk)->conn->hcon);
376+
sco_pi(sk)->conn = NULL;
377+
} else
378+
sco_chan_del(sk, ECONNRESET);
379+
break;
380+
372381
case BT_CONNECT:
373382
case BT_DISCONN:
374383
sco_chan_del(sk, ECONNRESET);

0 commit comments

Comments
 (0)