block/elevator: handle possible null pointer
PATCH 1/1 block/elevator: handle possible null pointer
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 <[email protected]>
--- block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/elevator.c +1 -1
@@ -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 ;
Signature · 1 line
2.27.0
Jens Axboe
maintainerQuoted 2 lines · Peng Hao
There is a check for
q->tag_setin the front ofelevator_get_default, and there should be a check here too.
I always get suspicious when I see patches like that. Is the other check valid? Why does it need to get checked? There's really no meat on the bone in this commit message.
Signature · 1 line
Jens Axboe