From f8aaf9b65a77267f749c1af641e46c3457d50701 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 17 Aug 2014 23:28:57 +0300 Subject: 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 Signed-off-by: Marcel Holtmann --- net/bluetooth/hci_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'net/bluetooth/hci_core.c') diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9b7145959a49..ed60d37ea646 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2541,6 +2541,7 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev) 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 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) 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 @@ void hci_conn_params_clear_all(struct hci_dev *hdev) 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); -- cgit v1.2.3-55-g7522