Thread (8 messages) 8 messages, 3 authors, 2023-04-26

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

From: Ming Lei <hidden>
Date: 2023-04-25 03:28:57
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help