Luiz Augusto von Dentz
bef3334183
Bluetooth: hci_core: Fix sleeping function called from invalid context
[ Upstream commit 4d94f05558271654670d18c26c912da0c1c15549 ]
This reworks hci_cb_list to not use mutex hci_cb_list_lock to avoid bugs
like the bellow:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5070, name: kworker/u9:2
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
4 locks held by kworker/u9:2/5070:
#0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
#0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x1770 kernel/workqueue.c:3335
#1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
#1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x1770 kernel/workqueue.c:3335
#2: ffff8880665d0078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xcf/0xae0 net/bluetooth/hci_event.c:6914
#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:750 [inline]
#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: hci_le_create_big_complete_evt+0xdb/0xae0 net/bluetooth/hci_event.c:6915
CPU: 0 PID: 5070 Comm: kworker/u9:2 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci0 hci_rx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
__might_resched+0x5d4/0x780 kernel/sched/core.c:10187
__mutex_lock_common kernel/locking/mutex.c:585 [inline]
__mutex_lock+0xc1/0xd70 kernel/locking/mutex.c:752
hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline]
hci_le_create_big_complete_evt+0x3d9/0xae0 net/bluetooth/hci_event.c:6939
hci_event_func net/bluetooth/hci_event.c:7514 [inline]
hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7569
hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171
process_one_work kernel/workqueue.c:3254 [inline]
process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335
worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
kthread+0x2f0/0x390 kernel/kthread.c:388
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
</TASK>
Reported-by: syzbot+2fb0835e0c9cefc34614@syzkaller.appspotmail.com
Tested-by: syzbot+2fb0835e0c9cefc34614@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2fb0835e0c9cefc34614
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-09 13:32:05 +01:00
..
2023-03-27 02:33:48 +00:00
2025-01-09 13:32:05 +01:00
2023-08-10 18:24:48 -07:00
2021-11-19 11:52:25 +00:00
2024-10-10 11:58:03 +02:00
2025-01-09 13:32:01 +01:00
2024-06-27 13:49:08 +02:00
2021-11-17 20:17:05 -08:00
2023-10-04 14:22:27 -07:00
2023-06-15 22:33:26 -07:00
2023-08-10 19:31:52 -07:00
2023-11-28 17:19:54 +00:00
2020-02-28 14:51:30 +01:00
2023-02-20 16:46:10 -08:00
2024-04-17 11:19:29 +02:00
2019-05-30 11:26:41 -07:00
2023-05-01 07:43:19 +01:00
2024-05-02 16:32:40 +02:00
2024-08-29 17:33:21 +02:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2024-06-12 11:11:54 +02:00
2022-08-09 22:14:02 -07:00
2021-12-13 12:34:09 +00:00
2023-07-28 18:06:30 -07:00
2022-11-02 20:38:13 -07:00
2024-11-22 15:38:33 +01:00
2024-09-04 13:28:27 +02:00
2021-03-26 17:43:55 +01:00
2024-09-04 13:28:28 +02:00
2019-05-21 11:28:45 +02:00
2022-11-16 11:31:47 +02:00
2024-04-03 15:28:54 +02:00
2024-04-03 15:28:27 +02:00
2023-01-27 11:19:46 +00:00
2020-07-15 07:45:24 -07:00
2020-03-27 19:40:38 -07:00
2021-12-22 15:03:47 -08:00
2022-07-22 12:53:22 +01:00
2023-07-14 20:39:29 -07:00
2022-07-24 18:39:17 -06:00
2023-07-27 17:17:32 -07:00
2022-07-22 12:53:22 +01:00
2023-01-20 09:33:22 +00:00
2023-08-27 17:08:45 -07:00
2023-08-19 15:30:15 +01:00
2023-08-14 08:01:06 +01:00
2023-04-09 15:35:49 +01:00
2023-07-18 09:47:08 +02:00
2019-12-16 16:09:44 -08:00
2021-11-29 19:50:45 -08:00
2022-12-05 21:58:27 -08:00
2024-06-16 13:47:44 +02:00
2023-03-28 18:52:28 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2020-04-20 07:34:16 +02:00
2022-07-22 12:53:22 +01:00
2021-12-06 16:06:02 -08:00
2019-12-24 22:37:30 -08:00
2021-12-16 07:18:35 -08:00
2022-07-28 22:21:54 -07:00
2023-08-02 10:09:31 +01:00
2023-08-02 10:09:32 +01:00
2023-11-20 11:59:34 +01:00
2023-04-12 16:40:39 -07:00
2022-12-01 15:09:10 +01:00
2023-08-08 15:58:23 -07:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2024-11-01 01:58:23 +01:00
2022-10-31 10:43:04 +00:00
2021-01-29 20:39:14 -08:00
2024-05-17 12:02:07 +02:00
2023-06-10 00:11:41 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2023-07-28 14:07:59 -07:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2024-12-09 10:31:35 +01:00
2023-03-23 21:51:30 +01:00
2023-12-20 17:01:45 +01:00
2019-04-22 21:50:53 -07:00
2022-07-22 12:53:22 +01:00
2023-08-15 13:57:51 -07:00
2023-08-14 07:06:13 +01:00
2024-07-05 09:33:48 +02:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2023-07-14 20:39:29 -07:00
2023-08-15 13:57:51 -07:00
2024-01-31 16:19:01 -08:00
2024-08-29 17:33:46 +02:00
2019-02-08 21:50:15 -08:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2024-12-14 19:59:35 +01:00
2024-12-14 19:59:35 +01:00
2022-04-25 11:40:45 +01:00
2024-08-03 08:54:05 +02:00
2024-11-08 16:28:18 +01:00
2023-04-22 01:39:41 +02:00
2024-10-04 16:29:56 +02:00
2022-09-29 07:18:00 +02:00
2022-07-22 12:53:22 +01:00
2022-10-31 20:14:27 -07:00
2024-03-01 13:35:04 +01:00
2023-09-13 07:18:04 +01:00
2023-08-22 21:40:40 +02:00
2024-08-29 17:33:46 +02:00
2020-06-20 17:22:22 -07:00
2018-07-11 23:10:19 -07:00
2024-12-19 18:11:28 +01:00
2023-08-04 15:33:17 -07:00
2023-08-04 15:33:17 -07:00
2022-07-22 12:53:22 +01:00
2023-07-20 10:46:28 +02:00
2021-10-13 09:40:46 -07:00
2024-01-31 16:19:01 -08:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-28 11:29:36 +02:00
2021-11-07 19:25:29 +00:00
2023-08-18 16:05:26 +02:00
2025-01-09 13:31:42 +01:00
2022-10-12 12:57:19 +02:00
2024-05-02 16:32:50 +02:00
2024-10-17 15:24:29 +02:00
2021-10-29 13:23:51 +01:00
2020-03-02 11:16:27 -08:00
2021-03-26 15:14:56 -07:00
2022-07-22 12:53:22 +01:00
2020-05-29 21:20:20 -07:00
2023-08-22 17:31:18 -07:00
2022-11-18 12:14:55 +00:00
2022-07-22 12:53:22 +01:00
2023-08-07 08:53:55 +01:00
2023-12-08 08:52:23 +01:00
2024-12-09 10:32:59 +01:00
2024-12-19 18:11:28 +01:00
2021-12-10 06:38:26 -08:00
2024-01-25 15:35:57 -08:00
2023-08-03 08:38:07 -07:00
2022-07-22 12:53:22 +01:00
2019-05-21 11:28:45 +02:00
2023-07-27 13:45:51 +02:00
2019-11-12 08:18:03 -08:00
2022-07-22 12:53:22 +01:00
2023-05-11 18:07:05 -07:00
2023-01-28 13:51:22 +01:00
2023-07-14 20:39:29 -07:00
2023-08-04 15:33:50 -07:00
2023-07-14 20:39:30 -07:00
2023-06-02 09:55:22 +01:00
2023-08-07 08:53:54 +01:00
2023-07-12 15:59:33 -07:00
2022-07-22 12:53:22 +01:00
2022-07-15 18:50:35 -07:00
2021-08-09 15:34:21 -07:00
2022-07-22 12:53:22 +01:00
2023-04-06 12:01:20 -07:00
2023-03-17 08:56:37 +00:00
2022-10-11 17:42:58 -06:00
2023-06-19 12:05:29 +02:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2023-08-16 11:09:17 +01:00
2023-06-19 11:32:58 -07:00
2023-07-14 20:39:30 -07:00
2024-10-17 15:24:29 +02:00
2019-04-22 21:47:25 -07:00
2024-10-17 15:24:28 +02:00
2023-09-04 11:00:17 +01:00
2022-07-22 12:53:22 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2024-12-14 19:59:37 +01:00
2019-10-05 16:29:00 -07:00
2022-10-25 11:35:16 +02:00
2025-01-02 10:32:00 +01:00
2023-08-03 18:10:10 -07:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2024-03-01 13:35:06 +01:00
2023-02-16 09:27:07 +01:00
2019-05-30 11:26:32 -07:00
2024-10-04 16:29:41 +02:00
2024-07-18 13:21:12 +02:00
2019-05-30 11:26:32 -07:00
2023-07-28 14:07:59 -07:00
2019-10-04 14:07:07 -07:00
2024-11-17 15:08:57 +01:00
2023-08-01 15:06:27 -07:00
2022-12-12 15:04:39 -08:00
2022-07-22 12:53:22 +01:00
2023-11-20 11:58:56 +01:00
2023-08-07 08:53:55 +01:00
2023-11-20 11:58:56 +01:00
2019-11-14 18:12:17 -08:00
2023-08-02 10:58:26 +01:00
2023-03-18 12:23:34 +00:00
2022-07-22 12:53:22 +01:00
2024-01-31 16:19:04 -08:00
2024-01-10 17:16:54 +01:00
2023-08-03 08:38:07 -07:00
2024-11-01 01:58:28 +01:00
2023-07-19 09:56:49 -07:00