All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
@ 2022-03-16 15:33 Niels Dossche
  2022-03-16 15:38 ` Marcel Holtmann
  2022-03-16 15:40 ` patchwork-bot+bluetooth
  0 siblings, 2 replies; 6+ messages in thread
From: Niels Dossche @ 2022-03-16 15:33 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz, Niels Dossche

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()")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---
 net/bluetooth/hci_conn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 04ebe901e86f..3bb2b3b6a1c9 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -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;
 	}
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
  2022-03-16 15:33 [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed Niels Dossche
@ 2022-03-16 15:38 ` Marcel Holtmann
  2022-03-16 15:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2022-03-16 15:38 UTC (permalink / raw)
  To: Niels Dossche; +Cc: BlueZ, Johan Hedberg, Luiz Augusto von Dentz

Hi Niels,

> 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()")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
> ---
> net/bluetooth/hci_conn.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
  2022-03-16 15:33 [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed Niels Dossche
  2022-03-16 15:38 ` Marcel Holtmann
@ 2022-03-16 15:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2022-03-16 15:40 UTC (permalink / raw)
  To: Niels Dossche; +Cc: linux-bluetooth, marcel, johan.hedberg, luiz.dentz

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:

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()")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
  2022-03-16 15:32 ` Marcel Holtmann
@ 2022-03-16 15:33   ` Niels Dossche
  0 siblings, 0 replies; 6+ messages in thread
From: Niels Dossche @ 2022-03-16 15:33 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: netdev, Johan Hedberg, Luiz Augusto von Dentz

On 16/03/2022 16:32, Marcel Holtmann wrote:
> Hi Niels,
> 
>> 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()")
>> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
>> ---
>> net/bluetooth/hci_conn.c | 2 ++
>> 1 file changed, 2 insertions(+)
> 
> please send net/bluetooth/ to linux-bluetooth mailing list.
> 
> Regards
> 
> Marcel
> 

Hi Marcel
My bad, I'll resend it to there, I have copied the wrong mail address.
Regards
Niels

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
  2022-03-16 15:20 Niels Dossche
@ 2022-03-16 15:32 ` Marcel Holtmann
  2022-03-16 15:33   ` Niels Dossche
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2022-03-16 15:32 UTC (permalink / raw)
  To: Niels Dossche; +Cc: netdev, Johan Hedberg, Luiz Augusto von Dentz

Hi Niels,

> 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()")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
> ---
> net/bluetooth/hci_conn.c | 2 ++
> 1 file changed, 2 insertions(+)

please send net/bluetooth/ to linux-bluetooth mailing list.

Regards

Marcel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
@ 2022-03-16 15:20 Niels Dossche
  2022-03-16 15:32 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Niels Dossche @ 2022-03-16 15:20 UTC (permalink / raw)
  To: netdev
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz, Niels Dossche

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()")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---
 net/bluetooth/hci_conn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 04ebe901e86f..3bb2b3b6a1c9 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -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;
 	}
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-16 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 15:33 [PATCH] Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed Niels Dossche
2022-03-16 15:38 ` Marcel Holtmann
2022-03-16 15:40 ` patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2022-03-16 15:20 Niels Dossche
2022-03-16 15:32 ` Marcel Holtmann
2022-03-16 15:33   ` Niels Dossche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.