diff mbox

blk-mq: Fix NULL pointer updating nr_requests

Message ID 1455832595-20485-1-git-send-email-keith.busch@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Keith Busch Feb. 18, 2016, 9:56 p.m. UTC
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>
---
 block/blk-mq.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jens Axboe Feb. 19, 2016, 10:19 p.m. UTC | #1
On 02/18/2016 02:56 PM, Keith Busch wrote:
> 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.

Applied, thanks Keith.
diff mbox

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 56c0a72..68981d8 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2330,6 +2330,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;