]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix blk_mq_attempt_bio_merge and rq_qos_throttle protection
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 8 Mar 2022 08:09:15 +0000 (17:09 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Mar 2022 00:48:39 +0000 (17:48 -0700)
commit5664e97abe0fa466f662438a09e5152fee77cad8
treec210cb834f618202ce257ca3085992afe4d5ed5a
parent4aa5f4218bf6bd4b89b6db8bb1744599b6abfabf
block: fix blk_mq_attempt_bio_merge and rq_qos_throttle protection

Commit f5716f288dbb ("block: don't protect submit_bio_checks by
q_usage_counter") moved blk_mq_attempt_bio_merge and rq_qos_throttle
calls out of q_usage_counter protection. However, these functions require
q_usage_counter protection. The blk_mq_attempt_bio_merge call without
the protection resulted in blktests block/005 failure with KASAN null-
ptr-deref or use-after-free at bio merge. The rq_qos_throttle call
without the protection caused kernel hang at qos throttle.

To fix the failures, move the blk_mq_attempt_bio_merge and
rq_qos_throttle calls back to q_usage_counter protection.

Fixes: f5716f288dbb ("block: don't protect submit_bio_checks by q_usage_counter")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20220308080915.3473689-1-shinichiro.kawasaki@wdc.com
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c