diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 85a30fb..0b2f6be 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -541,9 +541,10 @@ static void hci_uart_tty_close(struct tty_struct *tty) cancel_work_sync(&hu->write_work); if (hdev) { - if (test_bit(HCI_UART_REGISTERED, &hu->flags)) + if (test_bit(HCI_UART_REGISTERED, &hu->flags)) { hci_unregister_dev(hdev); - hci_free_dev(hdev); + hci_free_dev(hdev); + } } hu->proto->close(hu); } diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index dcc0dc6..d013cfa 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1489,6 +1489,7 @@ void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event, int flag, struct sock *skip_sk); void hci_sock_dev_event(struct hci_dev *hdev, int event); +void hci_release_hdev(struct hci_dev *hdev); #define HCI_MGMT_VAR_LEN BIT(0) #define HCI_MGMT_NO_HDEV BIT(1) diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h index baca699..e6f16ee 100644 --- a/kernel/locking/lockdep_internals.h +++ b/kernel/locking/lockdep_internals.h @@ -90,13 +90,13 @@ enum { * conflicts and deadlocks. */ #define MAX_LOCKDEP_ENTRIES 16384UL -#define MAX_LOCKDEP_CHAINS_BITS 15 +#define MAX_LOCKDEP_CHAINS_BITS 17 #define MAX_STACK_TRACE_ENTRIES 262144UL #define STACK_TRACE_HASH_SIZE 8192 #else #define MAX_LOCKDEP_ENTRIES 32768UL -#define MAX_LOCKDEP_CHAINS_BITS 16 +#define MAX_LOCKDEP_CHAINS_BITS 18 /* * Stack-trace: tightly packed array of stack backtrace diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cbbc34a..0db652e 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3452,7 +3452,7 @@ int hci_register_dev(struct hci_dev *hdev) EXPORT_SYMBOL(hci_register_dev); /* Unregister HCI device */ -void hci_unregister_dev(struct hci_dev *hdev) +void hci_release_hdev(struct hci_dev *hdev) { int id; @@ -3462,14 +3462,6 @@ void hci_unregister_dev(struct hci_dev *hdev) id = hdev->id; - write_lock(&hci_dev_list_lock); - list_del(&hdev->list); - write_unlock(&hci_dev_list_lock); - - cancel_work_sync(&hdev->power_on); - - hci_dev_do_close(hdev); - if (!test_bit(HCI_INIT, &hdev->flags) && !hci_dev_test_flag(hdev, HCI_SETUP) && !hci_dev_test_flag(hdev, HCI_CONFIG)) { @@ -3514,10 +3506,20 @@ void hci_unregister_dev(struct hci_dev *hdev) hci_blocked_keys_clear(hdev); hci_dev_unlock(hdev); - hci_dev_put(hdev); - ida_simple_remove(&hci_index_ida, id); } + +void hci_unregister_dev(struct hci_dev *hdev) +{ + write_lock(&hci_dev_list_lock); + list_del(&hdev->list); + write_unlock(&hci_dev_list_lock); + + cancel_work_sync(&hdev->power_on); + hci_dev_do_close(hdev); + + hci_dev_put(hdev); +} EXPORT_SYMBOL(hci_unregister_dev); /* Suspend HCI device */ diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 9874844..3553b14 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,6 +83,11 @@ void hci_conn_del_sysfs(struct hci_conn *conn) static void bt_host_release(struct device *dev) { struct hci_dev *hdev = to_hci_dev(dev); + + /* The hdev was registered */ + if (hdev->workqueue) + hci_release_hdev(hdev); + kfree(hdev); module_put(THIS_MODULE); }