diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 13b8dc332541..f096d8989773 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -34,9 +34,16 @@ EXPORT_SYMBOL_GPL(blk_mq_sched_free_hctx_data); void blk_mq_sched_assign_ioc(struct request *rq) { struct request_queue *q = rq->q; - struct io_context *ioc = current->io_context; + struct io_context *ioc; struct io_cq *icq; + /* + * May not have an IO context if it's a passthrough request + */ + ioc = current->io_context; + if (!ioc) + return; + spin_lock_irq(&q->queue_lock); icq = ioc_lookup_icq(ioc, q); spin_unlock_irq(&q->queue_lock);