From: Peng Hao <flyingpenghao@gmail.com>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block/elevator: handle possible null pointer
Date: Tue, 21 Dec 2021 16:10:42 +0800 [thread overview]
Message-ID: <20211221081042.78799-1-flyingpeng@tencent.com> (raw)
There is a check for q->tag_set in the front of elevator_get_default,
and there should be a check here too.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
block/elevator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/elevator.c b/block/elevator.c
index 1f39f6e8ebb9..b7d0bead680c 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -636,7 +636,7 @@ static struct elevator_type *elevator_get_default(struct request_queue *q)
if (q->tag_set && q->tag_set->flags & BLK_MQ_F_NO_SCHED_BY_DEFAULT)
return NULL;
- if (q->nr_hw_queues != 1 &&
+ if (q->nr_hw_queues != 1 && q->tag_set &&
!blk_mq_is_shared_tags(q->tag_set->flags))
return NULL;
--
2.27.0
next reply other threads:[~2021-12-21 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 8:10 Peng Hao [this message]
2021-12-21 15:26 ` 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=20211221081042.78799-1-flyingpeng@tencent.com \
--to=flyingpenghao@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®