diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 15b33579007c..f593a9f39aa9 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -6,6 +6,8 @@ #include #include +static void sco_set_hci_cnn_null(struct hci_conn *conn); + static const struct class bt_class = { .name = "bluetooth", }; @@ -13,6 +15,7 @@ static const struct class bt_class = { static void bt_link_release(struct device *dev) { struct hci_conn *conn = to_hci_conn(dev); + sco_set_hci_cnn_null(conn); kfree(conn); } diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index c736186aba26..0a6404ba8e4b 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -76,6 +76,14 @@ struct sco_pinfo { #define SCO_CONN_TIMEOUT (HZ * 40) #define SCO_DISCONN_TIMEOUT (HZ * 2) +static void sco_set_hci_cnn_null(struct hci_conn *conn) +{ + struct sco_conn *scn = container_of(conn, struct sco_conn, hcon); + sco_conn_lock(scn); + scn->hcon = NULL; + sco_conn_unlock(scn); +} + static void sco_sock_timeout(struct work_struct *work) { struct sco_conn *conn = container_of(work, struct sco_conn,