kernel_samsung_a53x/net/bluetooth
Tetsuo Handa 70f21ff8b6 Bluetooth: hci_core: cancel all works upon hci_unregister_dev()
[ Upstream commit 0d151a103775dd9645c78c97f77d6e2a5298d913 ]

syzbot is reporting that calling hci_release_dev() from hci_error_reset()
due to hci_dev_put() from hci_error_reset() can cause deadlock at
destroy_workqueue(), for hci_error_reset() is called from
hdev->req_workqueue which destroy_workqueue() needs to flush.

We need to make sure that hdev->{rx_work,cmd_work,tx_work} which are
queued into hdev->workqueue and hdev->{power_on,error_reset} which are
queued into hdev->req_workqueue are no longer running by the moment

       destroy_workqueue(hdev->workqueue);
       destroy_workqueue(hdev->req_workqueue);

are called from hci_release_dev().

Call cancel_work_sync() on these work items from hci_unregister_dev()
as soon as hdev->list is removed from hci_dev_list.

Reported-by: syzbot <syzbot+da0a9c9721e36db712e8@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=da0a9c9721e36db712e8
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 14:19:50 +01:00
..
bnep exit: Rename module_put_and_exit to module_put_and_kthread_exit 2024-11-19 12:27:50 +01:00
cmtp exit: Rename module_put_and_exit to module_put_and_kthread_exit 2024-11-19 12:27:50 +01:00
hidp exit: Rename module_put_and_exit to module_put_and_kthread_exit 2024-11-19 12:27:50 +01:00
rfcomm Bluetooth: rfcomm: Fix null-ptr-deref in rfcomm_check_security 2024-11-19 08:44:36 +01:00
6lowpan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
a2mp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
a2mp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
af_bluetooth.c Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg 2024-11-18 12:12:02 +01:00
amp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
amp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ecdh_helper.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ecdh_helper.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hci_conn.c Bluetooth: Fix bogus check for re-auth no supported with non-ssp 2024-11-18 12:12:38 +01:00
hci_core.c Bluetooth: hci_core: cancel all works upon hci_unregister_dev() 2024-11-19 14:19:50 +01:00
hci_debugfs.c Bluetooth: Fix TOCTOU in HCI debugfs implementation 2024-11-19 09:22:45 +01:00
hci_debugfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hci_event.c Bluetooth: hci_event: set the conn encrypted before conn establishes 2024-11-19 09:22:44 +01:00
hci_request.c Bluetooth: Fix memory leak in hci_req_sync_complete() 2024-11-19 11:32:19 +01:00
hci_request.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hci_sock.c Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name 2024-11-08 11:26:20 +01:00
hci_sysfs.c Bluetooth: Fix double free in hci_conn_cleanup 2024-11-18 11:43:12 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
l2cap_core.c Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ 2024-11-19 14:19:03 +01:00
l2cap_sock.c Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old() 2024-11-19 11:32:38 +01:00
leds.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
leds.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mgmt.c Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE 2024-11-18 12:12:02 +01:00
mgmt_config.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mgmt_config.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mgmt_util.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mgmt_util.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msft.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msft.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sco.c Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout 2024-11-19 11:32:45 +01:00
selftest.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
selftest.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp.c Bluetooth: SMP: Fix crash when receiving new connection when debug is enabled 2024-11-18 12:12:04 +01:00
smp.h Bluetooth: use inclusive language in SMP 2024-11-18 12:12:01 +01:00