block, bfq: fix null pointer dereference in bfq_bio_bfqg()
Yu Kuai authored
[ Upstream commit f02be900 ]

Out test found a following problem in kernel 5.10, and the same problem
should exist in mainline:

BUG: kernel NULL pointer dereference, address: 0000000000000094
PGD 0 P4D 0
Oops: 0000 [#1] SMP
CPU: 7 PID: 155 Comm: kworker/7:1 Not tainted 5.10.0-01932-g19e0ace2ca1d-dirty 4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-b4
Workqueue: kthrotld blk_throtl_dispatch_work_fn
RIP: 0010:bfq_bio_bfqg+0x52/0xc0
Code: 94 00 00 00 00 75 2e 48 8b 40 30 48 83 05 35 06 c8 0b 01 48 85 c0 74 3d 4b
RSP: 0018:ffffc90001a1fba0 EFLAGS: 00010002
RAX: ffff888100d60400 RBX: ffff8881132e7000 RCX: 0000000000000000
RDX: 0000000000000017 RSI: ffff888103580a18 RDI: ffff888103580a18
RBP: ffff8881132e7000 R08: 0000000000000000 R09: ffffc90001a1fe10
R10: 0000000000000a20 R11: 0000000000034320 R12: 0000000000000000
R13: ffff888103580a18 R14: ffff888114447000 R15: 0000000000000000
FS:  0...
1340f027
Name Last commit Last update
..
partitions block: drop unused includes in <linux/genhd.h>
Kconfig Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Kconfig.iosched Revert "block/mq-deadline: Add cgroup support"
Makefile Merge tag 'block-5.15-2021-09-11' of git://git.kernel.dk/linux-block
badblocks.c treewide: Use fallthrough pseudo-keyword
bdev.c block: simplify the block device syncing code
bfq-cgroup.c block, bfq: fix null pointer dereference in bfq_bio_bfqg()
bfq-iosched.c block, bfq: protect 'bfqd->queued' by 'bfqd->lock'
bfq-iosched.h bfq: Get rid of __bio_blkcg() usage
bfq-wf2q.c block/bfq_wf2q: correct weight to ioprio
bio-integrity.c block: bio-integrity: Advance seed correctly for larger interval sizes
bio.c block: ensure iov_iter advances for added pages
blk-cgroup-rwstat.c blk-cgroup: Fix the recursive blkg rwstat
blk-cgroup-rwstat.h blk-cgroup: separate out blkg_rwstat under CONFIG_BLK_CGROUP_RWSTAT
blk-cgroup.c block: fix bio_clone_blkg_association() to associate with proper blkcg_gq
blk-core.c block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for nowait
blk-crypto-fallback.c block: rename BIO_MAX_PAGES to BIO_MAX_VECS
blk-crypto-internal.h block: make blk_crypto_rq_bio_prep() able to fail
blk-crypto.c blk-crypto: fix check for too-large dun_bytes
blk-exec.c block: return errors from blk_execute_rq()
blk-flush.c block: Fix fsync always failed if once failed
blk-integrity.c block: flush the integrity workqueue in blk_integrity_unregister
blk-ioc.c block: fix default IO priority handling again
blk-iocost.c block: don't allow the same type rq_qos add more than once
blk-iolatency.c block: don't allow the same type rq_qos add more than once
blk-ioprio.c
blk-ioprio.h
blk-lib.c
blk-map.c
blk-merge.c
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c
blk-mq-sched.h
blk-mq-sysfs.c
blk-mq-tag.c
blk-mq-tag.h
blk-mq-virtio.c
blk-mq.c
blk-mq.h
blk-pm.c
blk-pm.h
blk-rq-qos.c
blk-rq-qos.h
blk-settings.c
blk-stat.c
blk-stat.h
blk-sysfs.c
blk-throttle.c
blk-timeout.c
blk-wbt.c
blk-wbt.h
blk-zoned.c
blk.h
bounce.c
bsg-lib.c
bsg.c
disk-events.c
elevator.c
fops.c
genhd.c
holder.c
ioctl.c
ioprio.c
keyslot-manager.c
kyber-iosched.c
mq-deadline.c
opal_proto.h
sed-opal.c
t10-pi.c