mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@sina.com>
To: syzbot+41e0d7cdfb1ecfc4a007@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [dm?] BUG: unable to handle kernel NULL pointer dereference in dm_bufio_client_create
Date: Thu,  5 Nov 2026 19:38:34 +0800	[thread overview]
Message-ID: <20261105113834.63912-1-eadavis@sina.com> (raw)
In-Reply-To: <6ae78418.6552420f.2a0efc.005b.GAE@google.com>

From: Edward Aadm Davis <eadavis@sina.com>

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git abf8c33470f7

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 358ed77ffb2b..f15d5815ffab 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3292,6 +3292,7 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	dm_block_t low_water_blocks;
 	struct dm_dev *metadata_dev;
 	blk_mode_t metadata_mode;
+	struct block_device *md_bdev, *data_bdev;
 
 	/*
 	 * FIXME Remove validation from scope of lock.
@@ -3331,6 +3332,7 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		ti->error = "Error opening metadata block device";
 		goto out_unlock;
 	}
+	md_bdev = metadata_dev->bdev;
 	warn_if_metadata_device_too_big(metadata_dev->bdev);
 
 	r = dm_get_device(ti, argv[1], BLK_OPEN_READ | BLK_OPEN_WRITE, &data_dev);
@@ -3338,6 +3340,9 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		ti->error = "Error getting data device";
 		goto out_metadata;
 	}
+	data_bdev = data_dev->bdev;
+	if (md_bdev == data_bdev)
+		metadata_dev = data_dev;
 
 	if (kstrtoul(argv[2], 10, &block_size) || !block_size ||
 	    block_size < DATA_DEV_BLOCK_SIZE_MIN_SECTORS ||
@@ -3428,7 +3433,8 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 out:
 	dm_put_device(ti, data_dev);
 out_metadata:
-	dm_put_device(ti, metadata_dev);
+	if (md_bdev != data_bdev)
+		dm_put_device(ti, metadata_dev);
 out_unlock:
 	mutex_unlock(&dm_thin_pool_table.mutex);
 

  parent reply	other threads:[~2026-11-05 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 18:25 syzbot
2026-11-02 13:31 ` Mikulas Patocka
2026-11-05 11:38 ` Edward Adam Davis [this message]
2026-11-05 12:14   ` syzbot

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=20261105113834.63912-1-eadavis@sina.com \
    --to=eadavis@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+41e0d7cdfb1ecfc4a007@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®