All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Bradshaw <sbradshaw@micron.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] blkmq: Fix NULL pointer deref when all reserved tags in use
Date: Wed, 18 Mar 2015 16:07:27 -0700	[thread overview]
Message-ID: <550A052F.6020601@micron.com> (raw)

When allocating from the reserved tags pool, bt_get() is called with
a NULL hctx.  If all tags are in use, the hw queue is kicked to push
out any pending IO, potentially freeing tags, and tag allocation is
retried.  The problem is that blk_mq_run_hw_queue() doesn't check for
a NULL hctx.  So we avoid it with a simple NULL hctx test.  

This issue was introduced by:
b32232073e80: blk-mq: fix hang in bt_get()

Tested by hammering mtip32xx with concurrent smartctl/hdparm.

Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Selvan Mani <smani@micron.com>
---
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index d53a764..9d7dd64 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -280,7 +280,8 @@ static int bt_get(struct blk_mq_alloc_data *data,
 		 * pending IO submits before going to sleep waiting for
 		 * some to complete.
 		 */
-		blk_mq_run_hw_queue(hctx, false);
+		if (hctx)
+			blk_mq_run_hw_queue(hctx, false);
 
 		/*
 		 * Retry tag allocation after running the hardware queue,

             reply	other threads:[~2015-03-18 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 23:07 Sam Bradshaw [this message]
2015-03-18 23:07 ` [PATCH v2] blkmq: Fix NULL pointer deref when all reserved tags in use Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550A052F.6020601@micron.com \
    --to=sbradshaw@micron.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.