瀏覽代碼

blk-mq: Fix NULL pointer updating nr_requests

A h/w context's tags are freed if it was not assigned a CPU. Check if
the context has tags before updating the depth.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Keith Busch 9 年之前
父節點
當前提交
e9137d4b93
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      block/blk-mq.c

+ 2 - 0
block/blk-mq.c

@@ -2336,6 +2336,8 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
 
 	ret = 0;
 	queue_for_each_hw_ctx(q, hctx, i) {
+		if (!hctx->tags)
+			continue;
 		ret = blk_mq_tag_update_depth(hctx->tags, nr);
 		if (ret)
 			break;