blk-mq: fix potential oops with polling and blk-mq scheduler
authorJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 20:53:28 +0000 (14:53 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 20:53:28 +0000 (14:53 -0600)
commit3a07bb1d7676ea24bc1585ba2a80604852c005e7
tree369e7828eca8e73a2d662aa8152fcb9cf4d5120c
parentbe56945c4edd5a3da15f8254b68d1ddb1588d0c4
blk-mq: fix potential oops with polling and blk-mq scheduler

If we have a scheduler attached, blk_mq_tag_to_rq() on the
scheduled tags will return NULL if a request is no longer
in flight. This is different than using the normal tags,
where it will always return the fixed request. Check for
this condition for polling, in case we happen to enter
polling for a completed request.

The request address remains valid, so this check and return
should be perfectly safe.

Fixes: bd166ef183c2 ("blk-mq-sched: add framework for MQ capable IO schedulers")
Tested-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c