Abhishek Pandit-Subedi
4e8c36c3b0
Bluetooth: Fix suspend notifier race
...
Unregister from suspend notifications and cancel suspend preparations
before running hci_dev_do_close. Otherwise, the suspend notifier may
race with unregister and cause cmd_timeout even after hdev has been
freed.
Below is the trace from when this panic was seen:
[ 832.578518] Bluetooth: hci_core.c:hci_cmd_timeout() hci0: command 0x0c05 tx timeout
[ 832.586200] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 832.586203] #PF: supervisor read access in kernel mode
[ 832.586205] #PF: error_code(0x0000) - not-present page
[ 832.586206] PGD 0 P4D 0
[ 832.586210] PM: suspend exit
[ 832.608870] Oops: 0000 [#1 ] PREEMPT SMP NOPTI
[ 832.613232] CPU: 3 PID: 10755 Comm: kworker/3:7 Not tainted 5.4.44-04894-g1e9dbb96a161 #1
[ 832.630036] Workqueue: events hci_cmd_timeout [bluetooth]
[ 832.630046] RIP: 0010:__queue_work+0xf0/0x374
[ 832.630051] RSP: 0018:ffff9b5285f1fdf8 EFLAGS: 00010046
[ 832.674033] RAX: ffff8a97681bac00 RBX: 0000000000000000 RCX: ffff8a976a000600
[ 832.681162] RDX: 0000000000000000 RSI: 0000000000000009 RDI: ffff8a976a000748
[ 832.688289] RBP: ffff9b5285f1fe38 R08: 0000000000000000 R09: ffff8a97681bac00
[ 832.695418] R10: 0000000000000002 R11: ffff8a976a0006d8 R12: ffff8a9745107600
[ 832.698045] usb 1-6: new full-speed USB device number 119 using xhci_hcd
[ 832.702547] R13: ffff8a9673658850 R14: 0000000000000040 R15: 000000000000001e
[ 832.702549] FS: 0000000000000000(0000) GS:ffff8a976af80000(0000) knlGS:0000000000000000
[ 832.702550] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 832.702550] CR2: 0000000000000000 CR3: 000000010415a000 CR4: 00000000003406e0
[ 832.702551] Call Trace:
[ 832.702558] queue_work_on+0x3f/0x68
[ 832.702562] process_one_work+0x1db/0x396
[ 832.747397] worker_thread+0x216/0x375
[ 832.751147] kthread+0x138/0x140
[ 832.754377] ? pr_cont_work+0x58/0x58
[ 832.758037] ? kthread_blkcg+0x2e/0x2e
[ 832.761787] ret_from_fork+0x22/0x40
[ 832.846191] ---[ end trace fa93f466da517212 ]---
Fixes: 9952d90ea2885 ("Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND")
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-07-28 20:27:14 +02:00
..
2020-03-27 09:29:56 +00:00
2020-02-24 13:02:53 -08:00
2020-05-07 18:11:07 -07:00
2020-05-18 17:35:02 -07:00
2020-05-20 20:31:36 -04:00
2020-05-24 13:47:27 -07:00
2020-05-26 15:19:29 -07:00
2020-07-28 20:27:14 +02:00
2020-05-19 17:56:34 +02:00
2020-04-03 13:12:26 -07:00
2020-06-01 11:56:11 -07:00
2020-04-30 12:13:07 -07:00
2019-12-08 11:52:02 +01:00
2020-05-31 17:48:46 -07:00
2020-06-02 11:50:23 -07:00
2020-05-18 17:35:02 -07:00
2020-05-01 17:02:27 -07:00
2020-04-28 14:39:46 -07:00
2020-05-31 17:48:46 -07:00
2020-05-23 16:56:17 -07:00
2020-05-29 17:28:30 -07:00
2020-05-07 17:40:02 -07:00
2020-05-08 22:25:10 -07:00
2020-06-01 14:57:14 -07:00
2020-06-01 15:53:08 -07:00
2020-05-19 12:50:14 -07:00
2020-03-16 17:14:02 -07:00
2020-05-31 17:48:46 -07:00
2020-04-30 12:56:35 -07:00
2020-02-26 20:38:13 -08:00
2020-05-31 17:48:46 -07:00
2020-05-29 21:20:20 -07:00
2020-05-31 17:48:46 -07:00
2020-01-09 18:36:22 -08:00
2020-06-01 11:46:30 -07:00
2020-05-12 18:12:40 -07:00
2020-05-13 12:30:50 -07:00
2020-05-04 12:05:56 -07:00
2020-03-12 22:34:48 -07:00
2020-04-25 20:48:21 -07:00
2020-03-15 00:25:25 -07:00
2020-04-27 02:07:40 -04:00
2020-05-23 16:36:05 -07:00
2020-05-31 17:48:46 -07:00
2020-05-28 11:11:45 -07:00
2019-12-16 10:15:49 +01:00
2020-05-04 12:05:56 -07:00
2020-05-28 11:11:46 -07:00
2020-06-01 12:01:05 -07:00
2020-05-31 17:48:46 -07:00
2020-05-30 18:12:25 -07:00
2020-05-28 11:11:46 -07:00
2020-02-26 20:58:33 -08:00
2020-06-02 15:13:47 -07:00
2020-06-01 14:48:32 -07:00
2020-02-28 12:12:53 -08:00
2020-05-30 17:44:01 -07:00
2020-05-31 17:48:46 -07:00
2020-05-06 22:10:13 -07:00
2020-05-31 17:48:46 -07:00
2020-05-31 17:48:46 -07:00
2020-06-01 12:05:45 -07:00
2020-05-23 16:56:17 -07:00
2020-05-10 12:28:41 -07:00
2020-05-23 16:56:17 -07:00
2020-05-29 13:10:39 -07:00