# git rev-parse -q --verify 751e5f5c753e8d447bcf89f9e96b9616ac081628^{commit} 751e5f5c753e8d447bcf89f9e96b9616ac081628 already have revision, skipping fetch # git checkout -q -f -B kisskb 751e5f5c753e8d447bcf89f9e96b9616ac081628 # git clean -qxdf # git log -1 commit 751e5f5c753e8d447bcf89f9e96b9616ac081628 Author: Michal Hocko Date: Fri Jan 8 11:18:29 2016 +0100 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: [] __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:[] 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: 373ccbe59270 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress") Reported-by: kernel test robot Signed-off-by: Michal Hocko Tested-by: Tetsuo Handa Cc: stable@vger.kernel.org Cc: Andrew Morton Signed-off-by: Linus Torvalds # < /opt/cross/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux-gcc --version # < git log --format=%s --max-count=1 751e5f5c753e8d447bcf89f9e96b9616ac081628 # < make -j 48 ARCH=i386 O=/home/kisskb/slave/build/linus_i386-randconfig_i386 CROSS_COMPILE=/opt/cross/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux- randconfig KCONFIG_SEED=0x38DB4AFD # Added to kconfig CONFIG_STANDALONE=y # yes \n | make -j 48 ARCH=i386 O=/home/kisskb/slave/build/linus_i386-randconfig_i386 CROSS_COMPILE=/opt/cross/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux- oldconfig yes: standard output: Broken pipe yes: write error # make -j 48 ARCH=i386 O=/home/kisskb/slave/build/linus_i386-randconfig_i386 CROSS_COMPILE=/opt/cross/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux- make[1]: Entering directory '/home/kisskb/slave/build/linus_i386-randconfig_i386' GEN ./Makefile scripts/kconfig/conf --silentoldconfig Kconfig arch/x86/Makefile:133: stack-protector enabled but compiler support broken /home/kisskb/slave/src/Makefile:660: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h HOSTCC scripts/basic/bin2c CHK include/config/kernel.release GEN ./Makefile WRAP arch/x86/include/generated/asm/clkdev.h WRAP arch/x86/include/generated/asm/cputime.h WRAP arch/x86/include/generated/asm/dma-contiguous.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h WRAP arch/x86/include/generated/asm/mm-arch-hooks.h CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h HOSTCC scripts/kallsyms HOSTCC scripts/conmakehash HOSTCC scripts/sortextable HOSTCC scripts/asn1_compiler HOSTCC scripts/extract-cert HOSTCC scripts/pnmtologo UPD include/config/kernel.release CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig cc1: error: unrecognized command line option '-fstack-protector-strong' CC scripts/mod/devicetable-offsets.s /home/kisskb/slave/src/scripts/Makefile.build:258: recipe for target 'scripts/mod/empty.o' failed cc1: error: unrecognized command line option '-fstack-protector-strong'make[3]: *** [scripts/mod/empty.o] Error 1 make[3]: *** Waiting for unfinished jobs.... /home/kisskb/slave/src/scripts/Makefile.build:153: recipe for target 'scripts/mod/devicetable-offsets.s' failed make[3]: *** [scripts/mod/devicetable-offsets.s] Error 1 HOSTCC arch/x86/tools/relocs_32.o HOSTCC arch/x86/tools/relocs_64.o HOSTCC arch/x86/tools/relocs_common.o Using /home/kisskb/slave/src as source for kernel /home/kisskb/slave/src/scripts/Makefile.build:403: recipe for target 'scripts/mod' failed make[2]: *** [scripts/mod] Error 2 make[2]: *** Waiting for unfinished jobs.... CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h HOSTLD arch/x86/tools/relocs /home/kisskb/slave/src/Makefile:545: recipe for target 'scripts' failed make[1]: *** [scripts] Error 2 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/home/kisskb/slave/build/linus_i386-randconfig_i386' Makefile:146: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 Command 'make -j 48 ARCH=i386 O=/home/kisskb/slave/build/linus_i386-randconfig_i386 CROSS_COMPILE=/opt/cross/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux- ' returned non-zero exit status 2 # rm -rf /home/kisskb/slave/build/linus_i386-randconfig_i386 # Build took: 0:00:04.544901