mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
Date: Mon, 21 Jul 2025 09:53:43 +0800	[thread overview]
Message-ID: <20250721015344.2609-1-hdanton@sina.com> (raw)
In-Reply-To: <67f82b19.050a0220.355867.000f.GAE@google.com>

> Date: Thu, 10 Apr 2025 13:33:29 -0700	[thread overview]
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    2eb959eeecc6 Merge tag 'for-linus-6.15a-rc2-tag' of git://..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16fdf23f980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=4c918722cb7e3d7
> dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
> compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1352b7e4580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17499d78580000

#syz test  upstream  master

--- x/drivers/block/loop.c
+++ y/drivers/block/loop.c
@@ -443,9 +443,8 @@ static void loop_reread_partitions(struc
 			__func__, lo->lo_number, lo->lo_file_name, rc);
 }
 
-static unsigned int loop_query_min_dio_size(struct loop_device *lo)
+static unsigned int loop_query_min_dio_size(struct file *file)
 {
-	struct file *file = lo->lo_backing_file;
 	struct block_device *sb_bdev = file->f_mapping->host->i_sb->s_bdev;
 	struct kstat st;
 
@@ -497,7 +496,8 @@ static int loop_validate_file(struct fil
 	return 0;
 }
 
-static void loop_assign_backing_file(struct loop_device *lo, struct file *file)
+static void loop_assign_backing_file(struct loop_device *lo, struct file *file,
+					unsigned int min_dio_size)
 {
 	lo->lo_backing_file = file;
 	lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping);
@@ -505,7 +505,7 @@ static void loop_assign_backing_file(str
 			lo->old_gfp_mask & ~(__GFP_IO | __GFP_FS));
 	if (lo->lo_backing_file->f_flags & O_DIRECT)
 		lo->lo_flags |= LO_FLAGS_DIRECT_IO;
-	lo->lo_min_dio_size = loop_query_min_dio_size(lo);
+	lo->lo_min_dio_size = min_dio_size;
 }
 
 static int loop_check_backing_file(struct file *file)
@@ -532,7 +532,7 @@ static int loop_change_fd(struct loop_de
 {
 	struct file *file = fget(arg);
 	struct file *old_file;
-	unsigned int memflags;
+	unsigned int memflags, blksz;
 	int error;
 	bool partscan;
 	bool is_loop;
@@ -581,9 +581,10 @@ static int loop_change_fd(struct loop_de
 
 	/* and ... switch */
 	disk_force_media_change(lo->lo_disk);
+	blksz = loop_query_min_dio_size(file);
 	memflags = blk_mq_freeze_queue(lo->lo_queue);
 	mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
-	loop_assign_backing_file(lo, file);
+	loop_assign_backing_file(lo, file, blksz);
 	loop_update_dio(lo);
 	blk_mq_unfreeze_queue(lo->lo_queue, memflags);
 	partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
@@ -974,6 +975,7 @@ static int loop_configure(struct loop_de
 {
 	struct file *file = fget(config->fd);
 	struct queue_limits lim;
+	unsigned int blksz;
 	int error;
 	loff_t size;
 	bool partscan;
@@ -1043,8 +1045,9 @@ static int loop_configure(struct loop_de
 	disk_force_media_change(lo->lo_disk);
 	set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
 
+	blksz = loop_query_min_dio_size(file);
 	lo->lo_device = bdev;
-	loop_assign_backing_file(lo, file);
+	loop_assign_backing_file(lo, file, blksz);
 
 	lim = queue_limits_start_update(lo->lo_queue);
 	loop_update_limits(lo, &lim, config->block_size);
--

  parent reply	other threads:[~2025-07-21  1:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  8:32 syzbot
2025-04-10 20:33 ` syzbot
2025-07-20 23:30   ` Hillf Danton
2025-07-21  0:21     ` syzbot
2025-07-21  1:53   ` Hillf Danton [this message]
2025-07-21  2:17     ` syzbot
2025-07-20 13:33 ` 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=20250721015344.2609-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+4bb2305559463e8f6a2a@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®