Bluetooth: Fix using hci_conn_get() for hci_conn pointers
Wherever we keep hci_conn pointers around we should be using
hci_conn_get/put to ensure that they stay valid. This patch fixes
all places violating against the principle currently.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9b71459..ed60d37 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2541,6 +2541,7 @@
list_for_each_entry(p, &hdev->le_conn_params, list) {
if (p->conn) {
hci_conn_drop(p->conn);
+ hci_conn_put(p->conn);
p->conn = NULL;
}
list_del_init(&p->action);
@@ -3734,8 +3735,10 @@
if (!params)
return;
- if (params->conn)
+ if (params->conn) {
hci_conn_drop(params->conn);
+ hci_conn_put(params->conn);
+ }
list_del(¶ms->action);
list_del(¶ms->list);
@@ -3767,8 +3770,10 @@
struct hci_conn_params *params, *tmp;
list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
- if (params->conn)
+ if (params->conn) {
hci_conn_drop(params->conn);
+ hci_conn_put(params->conn);
+ }
list_del(¶ms->action);
list_del(¶ms->list);
kfree(params);