Bluetooth: hci_sync: add lock to protect HCI_UNREGISTER
authorZhengping Jiang <jiangzp@google.com>
Thu, 25 May 2023 00:11:58 +0000 (17:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 09:15:18 +0000 (11:15 +0200)
commit17aac1200222e529a936b0bf9fa9827d0fbba21f
tree6e15c93c8b0e25c918c27e7a4af09f53726df271
parent5f285409c91bb97d78b05477d57a921ba1156465
Bluetooth: hci_sync: add lock to protect HCI_UNREGISTER

[ Upstream commit 1857c19941c87eb36ad47f22a406be5dfe5eff9f ]

When the HCI_UNREGISTER flag is set, no jobs should be scheduled. Fix
potential race when HCI_UNREGISTER is set after the flag is tested in
hci_cmd_sync_queue.

Fixes: 0b94f2651f56 ("Bluetooth: hci_sync: Fix queuing commands when HCI_UNREGISTER is set")
Signed-off-by: Zhengping Jiang <jiangzp@google.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c
net/bluetooth/hci_sync.c