Skip to contentSkip to conversation

bluetooth:Fix error handling in the function le_conn_timeout

PATCH Superseded 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 the function le_conn_timeout

This fixes error handling in the function le_conn_timeout by checking if the internal call to the function hci_send_cmd has failed by returning a error and if so return immediately to this function's caller as we cannot continue this function's work after this failed function call.

---
 net/bluetooth/hci_conn.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/bluetooth/hci_conn.c +3 -2
index 2c48bf0..2d37437 100644
@@ -420,8 +420,9 @@ static void le_conn_timeout(struct work_struct *work)
 	 */
 	if (conn->role == HCI_ROLE_SLAVE) {
 		u8 enable = 0x00;
-		hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-			     &enable);
+		if (hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
+				 &enable))
+			return;
 		hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT);
 		return;
 	}
Signature · 1 line
2.1.4