]> Pileus Git - ~andy/linux/blobdiff - net/bluetooth/sco.c
Revert "Bluetooth: Fix possible deadlock in SCO code"
[~andy/linux] / net / bluetooth / sco.c
index eea17cdcaf7f30aa87c9a4a5a07859aac2891fab..531a93d613d4f3f86eff5174cdbb1236b75cfb53 100644 (file)
@@ -131,15 +131,6 @@ static int sco_conn_del(struct hci_conn *hcon, int err)
                sco_sock_clear_timer(sk);
                sco_chan_del(sk, err);
                bh_unlock_sock(sk);
-
-               sco_conn_lock(conn);
-               conn->sk = NULL;
-               sco_pi(sk)->conn = NULL;
-               sco_conn_unlock(conn);
-
-               if (conn->hcon)
-                       hci_conn_put(conn->hcon);
-
                sco_sock_kill(sk);
        }
 
@@ -885,6 +876,16 @@ static void sco_chan_del(struct sock *sk, int err)
 
        BT_DBG("sk %p, conn %p, err %d", sk, conn, err);
 
+       if (conn) {
+               sco_conn_lock(conn);
+               conn->sk = NULL;
+               sco_pi(sk)->conn = NULL;
+               sco_conn_unlock(conn);
+
+               if (conn->hcon)
+                       hci_conn_put(conn->hcon);
+       }
+
        sk->sk_state = BT_CLOSED;
        sk->sk_err   = err;
        sk->sk_state_change(sk);