]> git.baikalelectronics.ru Git - kernel.git/commit
block: pop cached rq before potentially blocking rq_qos_throttle()
authorJens Axboe <axboe@kernel.dk>
Tue, 21 Jun 2022 16:03:57 +0000 (10:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jun 2022 16:59:58 +0000 (10:59 -0600)
commit938222bf8960c8c283781486bb85d825ad09f9a8
tree71cff81d1e2aa899d00cf7117f3be44b9f6a944a
parent93aaf094ae4cd3d9e6a38ab37ae9c587ba106bbf
block: pop cached rq before potentially blocking rq_qos_throttle()

If rq_qos_throttle() ends up blocking, then we will have invalidated and
flushed our current plug. Since blk_mq_get_cached_request() hasn't
popped the cached request off the plug list just yet, we end holding a
pointer to a request that is no longer valid. This insta-crashes with
rq->mq_hctx being NULL in the validity checks just after.

Pop the request off the cached list before doing rq_qos_throttle() to
avoid using a potentially stale request.

Fixes: 8902c17a3b41 ("block: fix blk_mq_attempt_bio_merge and rq_qos_throttle protection")
Reported-by: Dylan Yudaken <dylany@fb.com>
Tested-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c