]> exis.tech > repos - linux.git/blobdiff - net/bluetooth/sco.c
Merge tag 'hwmon-for-v7.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
[linux.git] / net / bluetooth / sco.c
index fcc597be5bbd58d7ab3a952316cb24c15d90db51..c05f79b7aa31208891649634f08fb682c7f2f73e 100644 (file)
@@ -570,10 +570,23 @@ static void __sco_sock_close(struct sock *sk)
 /* Must be called on unlocked socket. */
 static void sco_sock_close(struct sock *sk)
 {
+       struct sco_conn *conn;
+
+       lock_sock(sk);
+       conn = sco_pi(sk)->conn;
+       if (conn)
+               sco_conn_hold(conn);
+       release_sock(sk);
+
+       if (conn)
+               disable_delayed_work_sync(&conn->timeout_work);
+
        lock_sock(sk);
-       sco_sock_clear_timer(sk);
        __sco_sock_close(sk);
        release_sock(sk);
+
+       if (conn)
+               sco_conn_put(conn);
 }
 
 static void sco_sock_init(struct sock *sk, struct sock *parent)