diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index a5ac160c592e..cee87c6c9194 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -169,10 +169,11 @@ static void sco_chan_del(struct sock *sk, int err) sco_conn_lock(conn); conn->sk = NULL; sco_pi(sk)->conn = NULL; - sco_conn_unlock(conn); - - if (conn->hcon) + if (conn->hcon) { hci_conn_drop(conn->hcon); + conn->hcon = NULL; + } + sco_conn_unlock(conn); } sk->sk_state = BT_CLOSED; @@ -208,7 +209,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err) } /* Ensure no more work items will run before freeing conn. */ - cancel_delayed_work_sync(&conn->timeout_work); + disable_delayed_work_sync(&conn->timeout_work); hcon->sco_data = NULL; kfree(conn); @@ -442,17 +443,6 @@ static void __sco_sock_close(struct sock *sk) case BT_CONNECTED: case BT_CONFIG: - if (sco_pi(sk)->conn->hcon) { - sk->sk_state = BT_DISCONN; - sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); - sco_conn_lock(sco_pi(sk)->conn); - hci_conn_drop(sco_pi(sk)->conn->hcon); - sco_pi(sk)->conn->hcon = NULL; - sco_conn_unlock(sco_pi(sk)->conn); - } else - sco_chan_del(sk, ECONNRESET); - break; - case BT_CONNECT2: case BT_CONNECT: case BT_DISCONN: