All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Changhui Zhong <czhong@redhat.com>
Cc: linux-block@vger.kernel.org, ming.lei@redhat.com
Subject: Re: [bug report] BUG: kernel NULL pointer dereference, address: 00000000000000fc
Date: Tue, 25 Apr 2023 11:27:49 +0800	[thread overview]
Message-ID: <ZEdItaPqif8fp85H@ovpn-8-24.pek2.redhat.com> (raw)
In-Reply-To: <CAGVVp+XSpFsjfzSNxLiK9SFnLvLB-W7bPHk7tySkkX95BM5BoQ@mail.gmail.com>

On Tue, Apr 25, 2023 at 10:37:05AM +0800, Changhui Zhong wrote:
> Hello,
> 
> Below issue was triggered in my test,it caused system panic ,please
> help check it.
> branch: for-6.4/block
> https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
> 
> mdadm -CR /dev/md0 -l 1 -n 2 /dev/sda /dev/sdb -e 1.0
> sgdisk -n 0:0:+100MiB /dev/md0
> cat /proc/partitions
> mdadm -S /dev/md0
> mdadm -A /dev/md0 /dev/sda /dev/sdb
> cat /proc/partitions
> 
> 
> [   34.219123] BUG: kernel NULL pointer dereference, address: 00000000000000fc
> [   34.219507] #PF: supervisor read access in kernel mode
> [   34.219784] #PF: error_code(0x0000) - not-present page
> [   34.220039] PGD 0 P4D 0
> [   34.220176] Oops: 0000 [#1] PREEMPT SMP PTI
> [   34.220374] CPU: 8 PID: 1956 Comm: systemd-udevd Kdump: loaded Not
> tainted 6.3.0-rc2+ #1
> [   34.220787] Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360
> Gen9, BIOS P89 05/21/2018
> [   34.221188] RIP: 0010:blk_mq_sched_bio_merge+0x6d/0xf0

Hi Changhui,

Please try the following fix:

diff --git a/block/bdev.c b/block/bdev.c
index 850852fe4b78..fa2838ca2e6d 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -419,7 +419,11 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
        bdev->bd_inode = inode;
        bdev->bd_queue = disk->queue;
        bdev->bd_stats = alloc_percpu(struct disk_stats);
-       bdev->bd_has_submit_bio = false;
+
+       if (partno)
+               bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;
+       else
+               bdev->bd_has_submit_bio = false;
        if (!bdev->bd_stats) {
                iput(inode);
                return NULL;

Fixes: 9f4107b07b17 ("block: store bdev->bd_disk->fops->submit_bio state in bdev")


Thanks, 
Ming


  reply	other threads:[~2023-04-25  3:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25  2:37 [bug report] BUG: kernel NULL pointer dereference, address: 00000000000000fc Changhui Zhong
2023-04-25  3:27 ` Ming Lei [this message]
2023-04-26  5:56   ` Changhui Zhong
2023-04-26  6:05     ` Yu Kuai
2023-04-26  6:20       ` Changhui Zhong
2023-04-26  6:24         ` Yu Kuai
2023-04-26  6:32           ` Changhui Zhong
2023-04-26  8:38           ` Changhui Zhong

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=ZEdItaPqif8fp85H@ovpn-8-24.pek2.redhat.com \
    --to=ming.lei@redhat.com \
    --cc=czhong@redhat.com \
    --cc=linux-block@vger.kernel.org \
    /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.