Skip to contentSkip to conversation

Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed

PATCH Applied Niels Dossche 3 participants 3 messages Mar 16, 2022

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

PATCH 1/1 Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed

hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.

Fixes 3c857757ef6e ("Bluetooth: Add directed advertising support through connect()")
---
 net/bluetooth/hci_conn.c | 2 ++
 1 file changed, 2 insertions(+)
net/bluetooth/hci_conn.c +2 -0
index 04ebe901e86f..3bb2b3b6a1c9 100644
@@ -669,7 +669,9 @@ static void le_conn_timeout(struct work_struct *work)
 	if (conn->role == HCI_ROLE_SLAVE) {
 		/* Disable LE Advertising */
 		le_disable_advertising(hdev);
+		hci_dev_lock(hdev);
 		hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT);
+		hci_dev_unlock(hdev);
 		return;
 	}
 
Signature · 1 line
2.35.1
maintainer
#1 lore raw

Hi Niels,

Quoted 11 lines

hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.

Fixes 3c857757ef6e ("Bluetooth: Add directed advertising support through connect()")

---
net/bluetooth/hci_conn.c | 2 ++

1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#2 lore raw
In reply to Niels Dossche
This patch was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Quoted 10 lines · On Wed, 16 Mar 2022 16:33:50 +0100 you wrote:

hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.

Fixes 3c857757ef6e ("Bluetooth: Add directed advertising support through connect()")

[...]

Here is the summary with links:
- Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed

    https://git.kernel.org/bluetooth/bluetooth-next/c/7c686a32a512

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html