diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index c736186aba26..515b52e14b5f 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -415,6 +415,8 @@ static void sco_sock_cleanup_listen(struct sock *parent) */ static void sco_sock_kill(struct sock *sk) { + struct sco_conn *conn = container_of(sk, struct sco_conn, sk); + if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket) return; @@ -423,6 +425,9 @@ static void sco_sock_kill(struct sock *sk) /* Kill poor orphan */ bt_sock_unlink(&sco_sk_list, sk); sock_set_flag(sk, SOCK_DEAD); + sco_conn_lock(conn); + conn->sk = NULL; + sco_conn_unlock(conn); sock_put(sk); }