Re: [bug report] BUG: kernel NULL pointer dereference, address: 0000000000000048

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2023/05/10 9:49, Yu Kuai 写道:
Hi,

在 2023/05/10 9:29, Yu Kuai 写道:
Hi,

在 2023/05/10 8:49, Guangwu Zhang 写道:
Hi,

We found this kernel NULL pointer issue with latest
linux-block/for-next, please check it.

Kernel repo: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git


[  112.483804] BUG: kernel NULL pointer dereference, address: 0000000000000048

Base on this offset, 0x48 match bio->bi_blkg, so I guess this is because
bio is NULL, so the problem is that passthrough request insert into
elevator.

Sorry that attached patch has some problem, please try this one.

diff --git a/block/blk-mq.c b/block/blk-mq.c
index f6dad0886a2f..bd94d8a5416f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2712,6 +2712,7 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
        struct request **requeue_lastp = &requeue_list;
        unsigned int depth = 0;
        LIST_HEAD(list);
+       LIST_HEAD(passthrough_list);

        do {
                struct request *rq = rq_list_pop(&plug->mq_list);
@@ -2723,7 +2724,10 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
                        rq_list_add_tail(&requeue_lastp, rq);
                        continue;
                }
-               list_add(&rq->queuelist, &list);
+               if (blk_rq_is_passthrough(rq))
+                       list_add(&rq->queuelist, &passthrough_list);
+               else
+                       list_add(&rq->queuelist, &list);
                depth++;
        } while (!rq_list_empty(plug->mq_list));

@@ -2731,6 +2735,9 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched)
        trace_block_unplug(this_hctx->queue, depth, !from_sched);

        percpu_ref_get(&this_hctx->queue->q_usage_counter);
+       if (!list_empty(&passthrough_list))
+ blk_mq_insert_requests(this_hctx, this_ctx, &passthrough_list,
+                                      from_sched);
        if (this_hctx->queue->elevator) {

this_hctx->queue->elevator->type->ops.insert_requests(this_hctx,
                                &list, 0);

Thanks,
Kuai




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux