Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 21 Apr 2023 18:37:55 +0000 (11:37 -0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 24 Apr 2023 05:07:43 +0000 (22:07 -0700)
commitd883a4669a1def6d121ccf5e64ad28260d1c9531
treeff9b0a4339ccb01c05985d2a38fbacd1cf9056dc
parent20981ce2d5a5f79d17da1ace3a93df7b3c6ba3d6
Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running

This makes sure hci_cmd_sync_queue only queue new work if HCI_RUNNING
has been set otherwise there is a risk of commands being sent while
turning off.

Because hci_cmd_sync_queue can no longer queue work while HCI_RUNNING is
not set it cannot be used to power on adapters so instead
hci_cmd_sync_submit is introduced which bypass the HCI_RUNNING check, so
it behaves like the old implementation.

Link: https://lore.kernel.org/all/CAB4PzUpDMvdc8j2MdeSAy1KkAE-D3woprCwAdYWeOc-3v3c9Sw@mail.gmail.com/
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/hci_sync.h
net/bluetooth/hci_sync.c
net/bluetooth/mgmt.c