Skip to contentSkip to conversation

bluetooth:Fix error handling in various functions in the file hci_event.c

PATCH New Nicholas Krause 1 participant 1 message Aug 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluetooth:Fix error handling in various functions in the file hci_event.c

This fixes error handling in various functions to check if their internal call to the function hci_disconnect has failed and if so jump to their respective label for unlocking the passed hci_dev structure pointer before returning directly to their caller(s) for functions in the file hci_event.c.

---
 net/bluetooth/hci_event.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
net/bluetooth/hci_event.c +6 -3
index 32363c2..0df69f7 100644
@@ -2086,7 +2086,8 @@ static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status)
 	if (conn->state != BT_CONNECTED)
 		goto unlock;
 
-	hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
+	if (hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE))
+		goto unlock;
 	hci_conn_drop(conn);
 
 unlock:
@@ -2702,7 +2703,8 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
 	clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
 
 	if (ev->status && conn->state == BT_CONNECTED) {
-		hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
+		if (hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE))
+			goto unlock;
 		hci_conn_drop(conn);
 		goto unlock;
 	}
@@ -3975,7 +3977,8 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev,
 	clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
 
 	if (ev->status && conn->state == BT_CONNECTED) {
-		hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
+		if (hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE))
+			goto unlock;
 		hci_conn_drop(conn);
 		goto unlock;
 	}
Signature · 1 line
2.1.4