netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: core: Fix missing power_on work cancel on HCI close
@ 2022-04-26  8:18 Vasyl Vavrychuk
  2022-04-26 18:20 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Vasyl Vavrychuk @ 2022-04-26  8:18 UTC (permalink / raw)
  To: linux-kernel, netdev, linux-bluetooth
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Vasyl Vavrychuk

Move power_on work cancel to hci_dev_close_sync to ensure that power_on
work is canceled after HCI interface down, power off, rfkill, etc.

For example, if

    hciconfig hci0 down

is done early enough during boot, it may run before power_on work.
Then, power_on work will actually bring up interface despite above
hciconfig command.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
---
 net/bluetooth/hci_core.c | 2 --
 net/bluetooth/hci_sync.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b4782a6c1025..ad4f4ab0afca 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2675,8 +2675,6 @@ void hci_unregister_dev(struct hci_dev *hdev)
 	list_del(&hdev->list);
 	write_unlock(&hci_dev_list_lock);
 
-	cancel_work_sync(&hdev->power_on);
-
 	hci_cmd_sync_clear(hdev);
 
 	if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks))
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 8f4c5698913d..c5b0dbfc0379 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4058,6 +4058,7 @@ int hci_dev_close_sync(struct hci_dev *hdev)
 
 	bt_dev_dbg(hdev, "");
 
+	cancel_work_sync(&hdev->power_on);
 	cancel_delayed_work(&hdev->power_off);
 	cancel_delayed_work(&hdev->ncmd_timer);
 
-- 
2.30.2


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

* Re: [PATCH] Bluetooth: core: Fix missing power_on work cancel on HCI close
  2022-04-26  8:18 [PATCH] Bluetooth: core: Fix missing power_on work cancel on HCI close Vasyl Vavrychuk
@ 2022-04-26 18:20 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2022-04-26 18:20 UTC (permalink / raw)
  To: Vasyl Vavrychuk
  Cc: linux-kernel, netdev, linux-bluetooth, marcel, johan.hedberg,
	luiz.dentz, davem, kuba, pabeni

Hello:

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

On Tue, 26 Apr 2022 11:18:23 +0300 you wrote:
> Move power_on work cancel to hci_dev_close_sync to ensure that power_on
> work is canceled after HCI interface down, power off, rfkill, etc.
> 
> For example, if
> 
>     hciconfig hci0 down
> 
> [...]

Here is the summary with links:
  - Bluetooth: core: Fix missing power_on work cancel on HCI close
    https://git.kernel.org/bluetooth/bluetooth-next/c/2d866d8ec36f

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] 2+ messages in thread

end of thread, other threads:[~2022-04-26 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26  8:18 [PATCH] Bluetooth: core: Fix missing power_on work cancel on HCI close Vasyl Vavrychuk
2022-04-26 18:20 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).