public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [fs?] possible deadlock in __configfs_open_file
@ 2024-12-22  9:16 syzbot
  2026-01-08 17:32 ` Syzbot test for fixing recursive locking " Prithvi Tambewagh
                   ` (17 more replies)
  0 siblings, 18 replies; 21+ messages in thread
From: syzbot @ 2024-12-22  9:16 UTC (permalink / raw)
  To: hch, jlbec, linux-fsdevel, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    eabcdba3ad40 Merge tag 'for-6.13-rc3-tag' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17791f44580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c22efbd20f8da769
dashboard link: https://syzkaller.appspot.com/bug?extid=f6e8174215573a84b797
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=1449ccf8580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14a37730580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a9904ed2be77/disk-eabcdba3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/fb8d571e1cb3/vmlinux-eabcdba3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/76349070db25/bzImage-eabcdba3.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f6e8174215573a84b797@syzkaller.appspotmail.com

============================================
WARNING: possible recursive locking detected
6.13.0-rc3-syzkaller-00073-geabcdba3ad40 #0 Not tainted
--------------------------------------------
syz-executor381/5829 is trying to acquire lock:
ffff8880268ded78 (&p->frag_sem){.+.+}-{4:4}, at: __configfs_open_file+0xe8/0x9c0 fs/configfs/file.c:304

but task is already holding lock:
ffff8880268ded78 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
ffff8880268ded78 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x216/0x4b0 fs/configfs/file.c:229

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&p->frag_sem);
  lock(&p->frag_sem);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by syz-executor381/5829:
 #0: ffff88801e7f0420 (sb_writers#9){.+.+}-{0:0}, at: ksys_write+0x12b/0x250 fs/read_write.c:731
 #1: ffff888026d52688 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x75/0x4b0 fs/configfs/file.c:226
 #2: ffff8880268ded78 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
 #2: ffff8880268ded78 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x216/0x4b0 fs/configfs/file.c:229
 #3: ffffffff8ee089c8 (target_devices_lock){+.+.}-{4:4}, at: target_core_item_dbroot_store+0x23/0x2e0 drivers/target/target_core_configfs.c:114

stack backtrace:
CPU: 1 UID: 0 PID: 5829 Comm: syz-executor381 Not tainted 6.13.0-rc3-syzkaller-00073-geabcdba3ad40 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_deadlock_bug+0x2e3/0x410 kernel/locking/lockdep.c:3037
 check_deadlock kernel/locking/lockdep.c:3089 [inline]
 validate_chain kernel/locking/lockdep.c:3891 [inline]
 __lock_acquire+0x2117/0x3c40 kernel/locking/lockdep.c:5226
 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849
 down_read+0x9a/0x330 kernel/locking/rwsem.c:1524
 __configfs_open_file+0xe8/0x9c0 fs/configfs/file.c:304
 do_dentry_open+0xf59/0x1ea0 fs/open.c:945
 vfs_open+0x82/0x3f0 fs/open.c:1075
 do_open fs/namei.c:3828 [inline]
 path_openat+0x1e6a/0x2d60 fs/namei.c:3987
 do_filp_open+0x20c/0x470 fs/namei.c:4014
 file_open_name+0x2a4/0x450 fs/open.c:1347
 filp_open+0x4b/0x80 fs/open.c:1367
 target_core_item_dbroot_store+0x10d/0x2e0 drivers/target/target_core_configfs.c:134
 flush_write_buffer fs/configfs/file.c:207 [inline]
 configfs_write_iter+0x2f6/0x4b0 fs/configfs/file.c:229
 new_sync_write fs/read_write.c:586 [inline]
 vfs_write+0x5ae/0x1150 fs/read_write.c:679
 ksys_write+0x12b/0x250 fs/read_write.c:731
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f70a1169979
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcb84c8f08 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f70a11b3300 RCX: 00007f70a1169979
RDX: 0000000000000080 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 00007f70a11b30fd R08: 0000000000000006 R09: 0000000000000006
R10: 0000000000000006 R11: 0000000000000246 R12: 00007f70a11b817c


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Syzbot test for fixing recursive locking in __configfs_open_file
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
@ 2026-01-08 17:32 ` Prithvi Tambewagh
  2026-01-08 17:58   ` [syzbot] [fs?] possible deadlock " syzbot
  2026-01-21 15:02 ` Testing for v2: configfs: add lock class key to struct configfs_fragment for frag_sem Prithvi Tambewagh
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 21+ messages in thread
From: Prithvi Tambewagh @ 2026-01-08 17:32 UTC (permalink / raw)
  To: syzbot+f6e8174215573a84b797, hch, jlbec
  Cc: linux-fsdevel, linux-kernel, syzkaller-bugs, Prithvi Tambewagh

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f29052e6a87d 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,18 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
+	if (!d_is_dir(path.dentry)) {
+		path_put(&path);
 		pr_err("db_root: not a directory: %s\n", db_root_stage);
+		r = -ENOTDIR;
 		goto unlock;
 	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [syzbot] [fs?] possible deadlock in __configfs_open_file
  2026-01-08 17:32 ` Syzbot test for fixing recursive locking " Prithvi Tambewagh
@ 2026-01-08 17:58   ` syzbot
  0 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-01-08 17:58 UTC (permalink / raw)
  To: activprithvi, hch, jlbec, linux-fsdevel, linux-kernel,
	syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+f6e8174215573a84b797@syzkaller.appspotmail.com
Tested-by: syzbot+f6e8174215573a84b797@syzkaller.appspotmail.com

Tested on:

commit:         3a866087 Linux 6.18-rc1
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=101c119a580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e854293d7f44b5a5
dashboard link: https://syzkaller.appspot.com/bug?extid=f6e8174215573a84b797
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=11859f92580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Testing for v2: configfs: add lock class key to struct configfs_fragment for frag_sem
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
  2026-01-08 17:32 ` Syzbot test for fixing recursive locking " Prithvi Tambewagh
@ 2026-01-21 15:02 ` Prithvi Tambewagh
  2026-01-21 15:19   ` [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
  2026-02-06  9:02 ` Forwarded: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file() syzbot
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 21+ messages in thread
From: Prithvi Tambewagh @ 2026-01-21 15:02 UTC (permalink / raw)
  To: syzbot+f6e8174215573a84b797
  Cc: linux-fsdevel, linux-kernel, syzkaller-bugs, Prithvi Tambewagh

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 fs/configfs/configfs_internal.h | 1 +
 fs/configfs/dir.c               | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 0b969d0eb8ff..15bcde6c878b 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -21,6 +21,7 @@
 struct configfs_fragment {
 	atomic_t frag_count;
 	struct rw_semaphore frag_sem;
+	struct lock_class_key frag_sem_key;
 	bool frag_dead;
 };
 
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 81f4f06bc87e..10c76cef88c9 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -163,6 +163,8 @@ static struct configfs_fragment *new_fragment(void)
 	if (p) {
 		atomic_set(&p->frag_count, 1);
 		init_rwsem(&p->frag_sem);
+		lockdep_register_key(&p->frag_sem_key);
+		lockdep_set_class(&p->frag_sem, &p->frag_sem_key);
 		p->frag_dead = false;
 	}
 	return p;
@@ -170,8 +172,10 @@ static struct configfs_fragment *new_fragment(void)
 
 void put_fragment(struct configfs_fragment *frag)
 {
-	if (frag && atomic_dec_and_test(&frag->frag_count))
+	if (frag && atomic_dec_and_test(&frag->frag_count)) {
+		lockdep_unregister_key(&frag->frag_sem_key);
 		kfree(frag);
+	}
 }
 
 struct configfs_fragment *get_fragment(struct configfs_fragment *frag)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [syzbot] [fs?] possible deadlock in __configfs_open_file
  2026-01-21 15:02 ` Testing for v2: configfs: add lock class key to struct configfs_fragment for frag_sem Prithvi Tambewagh
@ 2026-01-21 15:19   ` syzbot
  0 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-01-21 15:19 UTC (permalink / raw)
  To: activprithvi, linux-fsdevel, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in __configfs_open_file

============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.0.17/6433 is trying to acquire lock:
ffff888027868d78 (&p->frag_sem_key){.+.+}-{4:4}, at: __configfs_open_file+0xe8/0x9c0 fs/configfs/file.c:304

but task is already holding lock:
ffff888027868d78 (&p->frag_sem_key){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
ffff888027868d78 (&p->frag_sem_key){.+.+}-{4:4}, at: configfs_write_iter+0x219/0x4e0 fs/configfs/file.c:229

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&p->frag_sem_key);
  lock(&p->frag_sem_key);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

5 locks held by syz.0.17/6433:
 #0: ffff888063464478 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2a2/0x370 fs/file.c:1232
 #1: ffff88801efbc420 (sb_writers#12){.+.+}-{0:0}, at: ksys_write+0x12a/0x250 fs/read_write.c:738
 #2: ffff8880760ba888 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x75/0x4e0 fs/configfs/file.c:226
 #3: ffff888027868d78 (&p->frag_sem_key){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
 #3: ffff888027868d78 (&p->frag_sem_key){.+.+}-{4:4}, at: configfs_write_iter+0x219/0x4e0 fs/configfs/file.c:229
 #4: ffffffff8f409828 (target_devices_lock){+.+.}-{4:4}, at: target_core_item_dbroot_store+0x21/0x350 drivers/target/target_core_configfs.c:114

stack backtrace:
CPU: 0 UID: 0 PID: 6433 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/13/2026
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_deadlock_bug+0x1e9/0x240 kernel/locking/lockdep.c:3041
 check_deadlock kernel/locking/lockdep.c:3093 [inline]
 validate_chain kernel/locking/lockdep.c:3895 [inline]
 __lock_acquire+0x1106/0x1c90 kernel/locking/lockdep.c:5237
 lock_acquire kernel/locking/lockdep.c:5868 [inline]
 lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825
 down_read+0x9b/0x480 kernel/locking/rwsem.c:1537
 __configfs_open_file+0xe8/0x9c0 fs/configfs/file.c:304
 do_dentry_open+0x982/0x1530 fs/open.c:965
 vfs_open+0x82/0x3f0 fs/open.c:1097
 do_open fs/namei.c:3975 [inline]
 path_openat+0x1de4/0x2cb0 fs/namei.c:4134
 do_filp_open+0x20b/0x470 fs/namei.c:4161
 file_open_name+0x2a3/0x450 fs/open.c:1381
 filp_open+0x4b/0x80 fs/open.c:1401
 target_core_item_dbroot_store+0x108/0x350 drivers/target/target_core_configfs.c:134
 flush_write_buffer fs/configfs/file.c:207 [inline]
 configfs_write_iter+0x306/0x4e0 fs/configfs/file.c:229
 new_sync_write fs/read_write.c:593 [inline]
 vfs_write+0x7d3/0x11d0 fs/read_write.c:686
 ksys_write+0x12a/0x250 fs/read_write.c:738
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd76878eec9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd7696dd038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fd7689e5fa0 RCX: 00007fd76878eec9
RDX: 0000000000000fff RSI: 0000200000000000 RDI: 0000000000000003
RBP: 00007fd768811f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fd7689e6038 R14: 00007fd7689e5fa0 R15: 00007ffe6bade968
 </TASK>
db_root: not a directory: /sys/kernel/config/target/dbroot


Tested on:

commit:         3a866087 Linux 6.18-rc1
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=14c307fc580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e854293d7f44b5a5
dashboard link: https://syzkaller.appspot.com/bug?extid=f6e8174215573a84b797
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17d7979a580000


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
  2026-01-08 17:32 ` Syzbot test for fixing recursive locking " Prithvi Tambewagh
  2026-01-21 15:02 ` Testing for v2: configfs: add lock class key to struct configfs_fragment for frag_sem Prithvi Tambewagh
@ 2026-02-06  9:02 ` syzbot
  2026-02-06 16:04 ` syzbot
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-06  9:02 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..6c3eed223faf 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,15 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR) {
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
+		}
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (2 preceding siblings ...)
  2026-02-06  9:02 ` Forwarded: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file() syzbot
@ 2026-02-06 16:04 ` syzbot
  2026-02-07 10:43 ` Forwarded: Testing for v4: " syzbot
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-06 16:04 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..6c3eed223faf 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,15 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR) {
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
+		}
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (3 preceding siblings ...)
  2026-02-06 16:04 ` syzbot
@ 2026-02-07 10:43 ` syzbot
  2026-02-08 16:41 ` syzbot
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-07 10:43 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

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

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..7b9899e2a219 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,15 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR) {
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
+		}
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (4 preceding siblings ...)
  2026-02-07 10:43 ` Forwarded: Testing for v4: " syzbot
@ 2026-02-08 16:41 ` syzbot
  2026-02-09  5:14 ` Forwarded: Testing for v3 " syzbot
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-08 16:41 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

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

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..5169eda2c563 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v3 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (5 preceding siblings ...)
  2026-02-08 16:41 ` syzbot
@ 2026-02-09  5:14 ` syzbot
  2026-02-09  6:05 ` Forwarded: Testing for v4 " syzbot
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09  5:14 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v3 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

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

---
 drivers/target/target_core_configfs.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f29052e6a87d 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,18 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
+	if (!d_is_dir(path.dentry)) {
+		path_put(&path);
 		pr_err("db_root: not a directory: %s\n", db_root_stage);
+		r = -ENOTDIR;
 		goto unlock;
 	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (6 preceding siblings ...)
  2026-02-09  5:14 ` Forwarded: Testing for v3 " syzbot
@ 2026-02-09  6:05 ` syzbot
  2026-02-09 14:29 ` Forwarded: Syzbot build test syzbot
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09  6:05 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

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

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..42709a3d68e9 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,12 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Syzbot build test
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (7 preceding siblings ...)
  2026-02-09  6:05 ` Forwarded: Testing for v4 " syzbot
@ 2026-02-09 14:29 ` syzbot
  2026-02-09 15:01 ` Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file() syzbot
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09 14:29 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Syzbot build test
Author: activprithvi@gmail.com

#syz test

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..1b7c7df4bca7 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -130,7 +130,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 	if (db_root_stage[read_bytes - 1] == '\n')
 		db_root_stage[read_bytes - 1] = '\0';
 
-	/* validate new db root before accepting it */
+	/* validate the new db root before accepting it */
 	fp = filp_open(db_root_stage, O_RDONLY, 0);
 	if (IS_ERR(fp)) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in  __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (8 preceding siblings ...)
  2026-02-09 14:29 ` Forwarded: Syzbot build test syzbot
@ 2026-02-09 15:01 ` syzbot
  2026-02-09 15:37 ` Forwarded: Testing for v4: " syzbot
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09 15:01 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in  __configfs_open_file()
Author: activprithvi@gmail.com

#syz test

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..5169eda2c563 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (9 preceding siblings ...)
  2026-02-09 15:01 ` Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file() syzbot
@ 2026-02-09 15:37 ` syzbot
  2026-02-09 15:45 ` Forwarded: Testing for v4 " syzbot
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09 15:37 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f94c242eff97 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (10 preceding siblings ...)
  2026-02-09 15:37 ` Forwarded: Testing for v4: " syzbot
@ 2026-02-09 15:45 ` syzbot
  2026-02-10 13:41 ` syzbot
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-09 15:45 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..5169eda2c563 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (11 preceding siblings ...)
  2026-02-09 15:45 ` Forwarded: Testing for v4 " syzbot
@ 2026-02-10 13:41 ` syzbot
  2026-02-10 13:48 ` syzbot
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-10 13:41 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f94c242eff97 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (12 preceding siblings ...)
  2026-02-10 13:41 ` syzbot
@ 2026-02-10 13:48 ` syzbot
  2026-02-10 13:53 ` Forwarded: Testing for v4: " syzbot
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-10 13:48 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..77742175a3e5 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {0};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (13 preceding siblings ...)
  2026-02-10 13:48 ` syzbot
@ 2026-02-10 13:53 ` syzbot
  2026-02-10 14:00 ` Forwarded: Testing for v4 " syzbot
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-10 13:53 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4: scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test upstream 3a8660878839faadb4f1a6dd72c3179c1df56787

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..5169eda2c563 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,7 +108,7 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
+	struct path path;
 	ssize_t r = -EINVAL;
 
 	mutex_lock(&target_devices_lock);
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (14 preceding siblings ...)
  2026-02-10 13:53 ` Forwarded: Testing for v4: " syzbot
@ 2026-02-10 14:00 ` syzbot
  2026-02-16  4:27 ` syzbot
  2026-02-16  5:18 ` syzbot
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-10 14:00 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f94c242eff97 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (15 preceding siblings ...)
  2026-02-10 14:00 ` Forwarded: Testing for v4 " syzbot
@ 2026-02-16  4:27 ` syzbot
  2026-02-16  5:18 ` syzbot
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-16  4:27 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

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

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f94c242eff97 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
  2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
                   ` (16 preceding siblings ...)
  2026-02-16  4:27 ` syzbot
@ 2026-02-16  5:18 ` syzbot
  17 siblings, 0 replies; 21+ messages in thread
From: syzbot @ 2026-02-16  5:18 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file()
Author: activprithvi@gmail.com

#syz test

Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
 drivers/target/target_core_configfs.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index b19acd662726..f94c242eff97 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -108,8 +108,8 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 					const char *page, size_t count)
 {
 	ssize_t read_bytes;
-	struct file *fp;
 	ssize_t r = -EINVAL;
+	struct path path = {};
 
 	mutex_lock(&target_devices_lock);
 	if (target_devices) {
@@ -131,17 +131,14 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 		db_root_stage[read_bytes - 1] = '\0';
 
 	/* validate new db root before accepting it */
-	fp = filp_open(db_root_stage, O_RDONLY, 0);
-	if (IS_ERR(fp)) {
+	r = kern_path(db_root_stage, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	if (r) {
 		pr_err("db_root: cannot open: %s\n", db_root_stage);
+		if (r == -ENOTDIR)
+			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
-	if (!S_ISDIR(file_inode(fp)->i_mode)) {
-		filp_close(fp, NULL);
-		pr_err("db_root: not a directory: %s\n", db_root_stage);
-		goto unlock;
-	}
-	filp_close(fp, NULL);
+	path_put(&path);
 
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-02-16  5:18 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-22  9:16 [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
2026-01-08 17:32 ` Syzbot test for fixing recursive locking " Prithvi Tambewagh
2026-01-08 17:58   ` [syzbot] [fs?] possible deadlock " syzbot
2026-01-21 15:02 ` Testing for v2: configfs: add lock class key to struct configfs_fragment for frag_sem Prithvi Tambewagh
2026-01-21 15:19   ` [syzbot] [fs?] possible deadlock in __configfs_open_file syzbot
2026-02-06  9:02 ` Forwarded: Testing for v3: scsi: target: fix recursive locking in __configfs_open_file() syzbot
2026-02-06 16:04 ` syzbot
2026-02-07 10:43 ` Forwarded: Testing for v4: " syzbot
2026-02-08 16:41 ` syzbot
2026-02-09  5:14 ` Forwarded: Testing for v3 " syzbot
2026-02-09  6:05 ` Forwarded: Testing for v4 " syzbot
2026-02-09 14:29 ` Forwarded: Syzbot build test syzbot
2026-02-09 15:01 ` Forwarded: Testing for v4 scsi: target: fix recursive locking in __configfs_open_file() syzbot
2026-02-09 15:37 ` Forwarded: Testing for v4: " syzbot
2026-02-09 15:45 ` Forwarded: Testing for v4 " syzbot
2026-02-10 13:41 ` syzbot
2026-02-10 13:48 ` syzbot
2026-02-10 13:53 ` Forwarded: Testing for v4: " syzbot
2026-02-10 14:00 ` Forwarded: Testing for v4 " syzbot
2026-02-16  4:27 ` syzbot
2026-02-16  5:18 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox