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>

authored by Luiz Augusto von Dentz and committed by Gustavo F. Padovan f21ca5ff b79f44c1

+9
+9
net/bluetooth/sco.c
··· 369 369 370 370 case BT_CONNECTED: 371 371 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 + 372 381 case BT_CONNECT: 373 382 case BT_DISCONN: 374 383 sco_chan_del(sk, ECONNRESET);