blk-mq: remove WARN_ON(!q->elevator) from blk_mq_sched_free_requests
authorMing Lei <ming.lei@redhat.com>
Tue, 11 Jun 2019 09:31:53 +0000 (17:31 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Jun 2019 09:05:58 +0000 (03:05 -0600)
blk_mq_sched_free_requests() may be called in failure path in which
q->elevator may not be setup yet, so remove WARN_ON(!q->elevator) from
blk_mq_sched_free_requests for avoiding the false positive.

This function is actually safe to call in case of !q->elevator because
hctx->sched_tags is checked.

Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Yi Zhang <yi.zhang@redhat.com>
Fixes: c3e2219216c9 ("block: free sched's request pool in blk_cleanup_queue")
Reported-by: syzbot+b9d0d56867048c7bcfde@syzkaller.appspotmail.com
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sched.c

index 500cb04901cc12906a8108c0795c5e3119e23d2c..2766066a15dbf9c35705e6d2278bb16fdc53fa7d 100644 (file)
@@ -555,7 +555,6 @@ void blk_mq_sched_free_requests(struct request_queue *q)
        int i;
 
        lockdep_assert_held(&q->sysfs_lock);
-       WARN_ON(!q->elevator);
 
        queue_for_each_hw_ctx(q, hctx, i) {
                if (hctx->sched_tags)