linux/block
Alexander Potapenko 4d608baac5 block: Initialize cfqq->ioprio_class in cfq_get_queue()
KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of
uninitialized memory in cfq_init_cfqq():

==================================================================
BUG: KMSAN: use of unitialized memory
...
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff8202ac97>] dump_stack+0x157/0x1d0 lib/dump_stack.c:51
 [<ffffffff813e9b65>] kmsan_report+0x205/0x360 ??:?
 [<ffffffff813eabbb>] __msan_warning+0x5b/0xb0 ??:?
 [<     inline     >] cfq_init_cfqq block/cfq-iosched.c:3754
 [<ffffffff8201e110>] cfq_get_queue+0xc80/0x14d0 block/cfq-iosched.c:3857
...
origin:
 [<ffffffff8103ab37>] save_stack_trace+0x27/0x50 arch/x86/kernel/stacktrace.c:67
 [<ffffffff813e836b>] kmsan_internal_poison_shadow+0xab/0x150 ??:?
 [<ffffffff813e88ab>] kmsan_poison_slab+0xbb/0x120 ??:?
 [<     inline     >] allocate_slab mm/slub.c:1627
 [<ffffffff813e533f>] new_slab+0x3af/0x4b0 mm/slub.c:1641
 [<     inline     >] new_slab_objects mm/slub.c:2407
 [<ffffffff813e0ef3>] ___slab_alloc+0x323/0x4a0 mm/slub.c:2564
 [<     inline     >] __slab_alloc mm/slub.c:2606
 [<     inline     >] slab_alloc_node mm/slub.c:2669
 [<ffffffff813dfb42>] kmem_cache_alloc_node+0x1d2/0x1f0 mm/slub.c:2746
 [<ffffffff8201d90d>] cfq_get_queue+0x47d/0x14d0 block/cfq-iosched.c:3850
...
==================================================================
(the line numbers are relative to 4.8-rc6, but the bug persists
upstream)

The uninitialized struct cfq_queue is created by kmem_cache_alloc_node()
and then passed to cfq_init_cfqq(), which accesses cfqq->ioprio_class
before it's initialized.

Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2017-01-23 08:30:28 -07:00
..
partitions partitions/efi: Fix integer overflow in GPT size calculation 2017-01-17 09:02:31 -07:00
badblocks.c
bio-integrity.c
bio.c
blk-cgroup.c blk-cgroup: don't quiesce the queue on policy activate/deactivate 2017-01-18 15:37:27 -07:00
blk-core.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-exec.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-flush.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-integrity.c
blk-ioc.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-lib.c
blk-map.c Merge branch 'for-4.10/block' of git://git.kernel.dk/linux-block 2016-12-13 10:19:16 -08:00
blk-merge.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-mq-cpumap.c
blk-mq-pci.c
blk-mq-sched.c blk-mq-sched: allow setting of default IO scheduler 2017-01-17 10:04:31 -07:00
blk-mq-sched.h blk-mq-sched: allow setting of default IO scheduler 2017-01-17 10:04:31 -07:00
blk-mq-sysfs.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-mq-tag.c blk-mq: allow resize of scheduler requests 2017-01-20 09:05:53 -07:00
blk-mq-tag.h blk-mq: allow resize of scheduler requests 2017-01-20 09:05:53 -07:00
blk-mq.c blk-mq: allow resize of scheduler requests 2017-01-20 09:05:53 -07:00
blk-mq.h blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-settings.c Merge branch 'for-4.10/block' of git://git.kernel.dk/linux-block 2016-12-13 10:19:16 -08:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c Merge branch 'for-4.10/block' of git://git.kernel.dk/linux-block 2016-12-13 10:19:16 -08:00
blk-tag.c blk-mq-sched: add framework for MQ capable IO schedulers 2017-01-17 10:04:20 -07:00
blk-throttle.c
blk-timeout.c
blk-wbt.c block: Avoid that sparse complains about context imbalance in __wbt_wait() 2017-01-02 09:48:47 -07:00
blk-wbt.h
blk-zoned.c
blk.h block: move rq_ioc() to blk.h 2017-01-17 10:03:42 -07:00
bounce.c
bsg-lib.c SCSI misc on 20161213 2016-12-14 10:49:33 -08:00
bsg.c sg_write()/bsg_write() is not fit to be called under KERNEL_DS 2016-12-22 23:03:42 -05:00
cfq-iosched.c block: Initialize cfqq->ioprio_class in cfq_get_queue() 2017-01-23 08:30:28 -07:00
cmdline-parser.c
compat_ioctl.c
deadline-iosched.c block: move existing elevator ops to union 2017-01-17 10:03:33 -07:00
elevator.c elevator: fix unnecessary put of elevator in failure case 2017-01-19 07:43:05 -07:00
genhd.c
ioctl.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
ioprio.c
Kconfig
Kconfig.iosched blk-mq-sched: allow setting of default IO scheduler 2017-01-17 10:04:31 -07:00
Makefile mq-deadline: add blk-mq adaptation of the deadline IO scheduler 2017-01-17 10:04:25 -07:00
mq-deadline.c mq-deadline: add blk-mq adaptation of the deadline IO scheduler 2017-01-17 10:04:25 -07:00
noop-iosched.c block: move existing elevator ops to union 2017-01-17 10:03:33 -07:00
partition-generic.c
scsi_ioctl.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
t10-pi.c