lkml.org 
[lkml]   [2021]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] block/elevator: handle possible null pointer
Date
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
\
 
 \ /
  Last update: 2021-12-21 09:12    [W:0.030 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site