@@ -2251,9 +2251,14 @@ static void bfq_request_merged(struct request_queue *q, struct request *req,
2251
2251
blk_rq_pos (container_of (rb_prev (& req -> rb_node ),
2252
2252
struct request , rb_node ))) {
2253
2253
struct bfq_queue * bfqq = bfq_init_rq (req );
2254
- struct bfq_data * bfqd = bfqq -> bfqd ;
2254
+ struct bfq_data * bfqd ;
2255
2255
struct request * prev , * next_rq ;
2256
2256
2257
+ if (!bfqq )
2258
+ return ;
2259
+
2260
+ bfqd = bfqq -> bfqd ;
2261
+
2257
2262
/* Reposition request in its sort_list */
2258
2263
elv_rb_del (& bfqq -> sort_list , req );
2259
2264
elv_rb_add (& bfqq -> sort_list , req );
@@ -2300,6 +2305,9 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq,
2300
2305
struct bfq_queue * bfqq = bfq_init_rq (rq ),
2301
2306
* next_bfqq = bfq_init_rq (next );
2302
2307
2308
+ if (!bfqq )
2309
+ return ;
2310
+
2303
2311
/*
2304
2312
* If next and rq belong to the same bfq_queue and next is older
2305
2313
* than rq, then reposition rq in the fifo (by substituting next
@@ -5454,12 +5462,12 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
5454
5462
5455
5463
spin_lock_irq (& bfqd -> lock );
5456
5464
bfqq = bfq_init_rq (rq );
5457
- if (at_head || blk_rq_is_passthrough (rq )) {
5465
+ if (! bfqq || at_head || blk_rq_is_passthrough (rq )) {
5458
5466
if (at_head )
5459
5467
list_add (& rq -> queuelist , & bfqd -> dispatch );
5460
5468
else
5461
5469
list_add_tail (& rq -> queuelist , & bfqd -> dispatch );
5462
- } else { /* bfqq is assumed to be non null here */
5470
+ } else {
5463
5471
idle_timer_disabled = __bfq_insert_request (bfqd , rq );
5464
5472
/*
5465
5473
* Update bfqq, because, if a queue merge has occurred
0 commit comments