Michal Hocko
751e5f5c75
vmstat: allocate vmstat_wq before it is used
kernel test robot has reported the following crash:
BUG: unable to handle kernel NULL pointer dereference at 00000100
IP: [<c1074df6>] __queue_work+0x26/0x390
*pdpt = 0000000000000000 *pde = f000ff53f000ff53 *pde = f000ff53f000ff53
Oops: 0000 [#1] PREEMPT PREEMPT SMP SMP
CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.4.0-rc4-00139-g373ccbe #1
Workqueue: events vmstat_shepherd
task: cb684600 ti: cb7ba000 task.ti: cb7ba000
EIP: 0060:[<c1074df6>] EFLAGS: 00010046 CPU: 0
EIP is at __queue_work+0x26/0x390
EAX: 00000046 EBX: cbb37800 ECX: cbb37800 EDX: 00000000
ESI: 00000000 EDI: 00000000 EBP: cb7bbe68 ESP: cb7bbe38
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 8005003b CR2: 00000100 CR3: 01fd5000 CR4: 000006b0
Stack:
Call Trace:
__queue_delayed_work+0xa1/0x160
queue_delayed_work_on+0x36/0x60
vmstat_shepherd+0xad/0xf0
process_one_work+0x1aa/0x4c0
worker_thread+0x41/0x440
kthread+0xb0/0xd0
ret_from_kernel_thread+0x21/0x40
The reason is that start_shepherd_timer schedules the shepherd work item
which uses vmstat_wq (vmstat_shepherd) before setup_vmstat allocates
that workqueue so if the further initialization takes more than HZ we
might end up scheduling on a NULL vmstat_wq. This is really unlikely
but not impossible.
Fixes: 373ccbe592 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Michal Hocko <[email protected]>
Tested-by: Tetsuo Handa <[email protected]>
Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2016-01-08 23:47:54 -08:00
..
2015-11-20 16:17:32 -08:00
2015-12-12 10:15:34 -08:00
2015-11-05 19:34:48 -08:00
2015-09-08 15:35:28 -07:00
2015-04-14 16:49:03 -07:00
2015-07-17 16:39:54 -07:00
2015-11-05 19:34:48 -08:00
2015-08-14 15:56:32 -07:00
2015-11-05 19:34:48 -08:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-06-02 08:33:35 -06:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-06-24 17:49:45 -07:00
2015-11-05 19:34:48 -08:00
2015-11-20 16:17:32 -08:00
2015-11-06 17:50:42 -08:00
2015-12-12 10:15:34 -08:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-09-08 15:35:28 -07:00
2015-09-11 16:42:39 -07:00
2015-11-05 19:34:48 -08:00
2015-12-29 17:45:49 -08:00
2015-12-29 17:45:49 -08:00
2015-11-06 17:50:42 -08:00
2015-11-18 16:54:36 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-06-30 19:44:56 -07:00
2015-11-05 19:34:48 -08:00
2015-09-10 13:29:01 -07:00
2015-09-04 16:54:41 -07:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-06-30 19:44:55 -07:00
2015-11-05 19:34:48 -08:00
2015-12-12 10:15:34 -08:00
2015-12-12 10:15:34 -08:00
2015-11-05 19:34:48 -08:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-08-13 12:32:00 -06:00
2015-09-08 15:35:28 -07:00
2015-07-17 16:39:54 -07:00
2015-11-23 09:44:58 +01:00
2015-11-05 19:34:48 -08:00
2015-10-17 17:48:20 +05:30
2015-04-11 22:27:12 -04:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-12-12 10:15:34 -08:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-09-08 15:35:28 -07:00
2015-06-02 08:33:33 -06:00
2015-09-04 16:54:41 -07:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-11-20 16:17:32 -08:00
2015-11-06 17:50:42 -08:00
2016-01-08 23:47:54 -08:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-12-18 14:25:40 -08:00