All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Yu Kuai <yukuai1@huaweicloud.com>,
	Guangwu Zhang <guazhang@redhat.com>,
	linux-block@vger.kernel.org, io-uring@vger.kernel.org,
	Jeff Moyer <jmoyer@redhat.com>, Ming Lei <ming.lei@redhat.com>,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [bug report] BUG: kernel NULL pointer dereference, address: 0000000000000048
Date: Wed, 10 May 2023 10:00:14 +0800	[thread overview]
Message-ID: <007af59f-4f4c-f779-a1b6-aaa81ff640b3@huaweicloud.com> (raw)
In-Reply-To: <cde5d326-4dcb-5b9c-9d58-fb1ef4b7f7a8@huaweicloud.com>

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


  reply	other threads:[~2023-05-10  2:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10  0:49 [bug report] BUG: kernel NULL pointer dereference, address: 0000000000000048 Guangwu Zhang
2023-05-10  1:29 ` Yu Kuai
2023-05-10  1:49   ` Yu Kuai
2023-05-10  2:00     ` Yu Kuai [this message]
2023-05-10  2:17       ` Jens Axboe
2023-05-10  3:20         ` Yu Kuai
     [not found]           ` <CAGS2=YocNy9PkgRzzRdHAK1gGdjMxzA--PYS=sPrX_nCe4U6QA@mail.gmail.com>
2023-05-10  6:39             ` Ming Lei
2023-05-10  6:55               ` Yu Kuai
2023-05-10 12:08               ` Guangwu Zhang
2023-05-10  4:52       ` Guangwu Zhang

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=007af59f-4f4c-f779-a1b6-aaa81ff640b3@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=guazhang@redhat.com \
    --cc=io-uring@vger.kernel.org \
    --cc=jmoyer@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=yukuai3@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.