* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
@ 2025-11-04 6:06 ` syzbot
2025-11-04 6:47 ` syzbot
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-11-04 6:06 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: listout@listout.xyz
On 30.10.2025 15:35, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: e53642b87a4f Merge tag 'v6.18-rc3-smb-server-fixes' of git..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=15ca5932580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=41ad820f608cb833
> dashboard link: https://syzkaller.appspot.com/bug?extid=4d8e30dbafb5c1260479
> compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17273fe2580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15374fe2580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/c69a7713b158/disk-e53642b8.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/7138dd74fe48/vmlinux-e53642b8.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/e715eea6ae3e/bzImage-e53642b8.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/cd997f980581/mount_0.gz
>
> The issue was bisected to:
>
> commit d2d6422f8bd17c6bb205133e290625a564194496
> Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Date: Fri Sep 6 10:59:04 2024 +0000
>
> x86: Allow to enable PREEMPT_RT.
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16e84e14580000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=15e84e14580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=11e84e14580000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+4d8e30dbafb5c1260479@syzkaller.appspotmail.com
> Fixes: d2d6422f8bd1 ("x86: Allow to enable PREEMPT_RT.")
#syz test
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 8f9fe1d7a690..895a75b036c3 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3023,12 +3023,14 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
/*
* Way 1 - Add new + remove old.
*/
+ preempt_disable();
err = ni_add_name(new_dir_ni, ni, new_de);
if (!err) {
err = ni_remove_name(dir_ni, ni, de, &de2, &undo);
WARN_ON(err && ni_remove_name(new_dir_ni, ni, new_de, &de2,
&undo));
}
+ preempt_enable();
/*
* Way 2 - Remove old + add new.
--
Regards,
listout
^ permalink raw reply related [flat|nested] 8+ messages in thread* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
2025-11-04 6:06 ` Forwarded: " syzbot
@ 2025-11-04 6:47 ` syzbot
2025-11-10 16:45 ` Forwarded: Add checks for key_len in indx_find syzbot
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-11-04 6:47 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: listout@listout.xyz
On 30.10.2025 15:35, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: e53642b87a4f Merge tag 'v6.18-rc3-smb-server-fixes' of git..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=15ca5932580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=41ad820f608cb833
> dashboard link: https://syzkaller.appspot.com/bug?extid=4d8e30dbafb5c1260479
> compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17273fe2580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15374fe2580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/c69a7713b158/disk-e53642b8.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/7138dd74fe48/vmlinux-e53642b8.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/e715eea6ae3e/bzImage-e53642b8.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/cd997f980581/mount_0.gz
>
> The issue was bisected to:
>
> commit d2d6422f8bd17c6bb205133e290625a564194496
> Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Date: Fri Sep 6 10:59:04 2024 +0000
>
> x86: Allow to enable PREEMPT_RT.
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16e84e14580000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=15e84e14580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=11e84e14580000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+4d8e30dbafb5c1260479@syzkaller.appspotmail.com
> Fixes: d2d6422f8bd1 ("x86: Allow to enable PREEMPT_RT.")
#syz test
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 8f9fe1d7a690..d9cca094960b 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3023,6 +3023,18 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
/*
* Way 1 - Add new + remove old.
*/
+ struct inode *dir_inode = &dir_ni->vfs_inode;
+ struct inode *new_dir_inode = &new_dir_ni->vfs_inode;
+
+ if (dir_inode == new_dir_inode) {
+ inode_lock(dir_inode);
+ } else if (dir_inode < new_dir_inode) {
+ inode_lock(dir_inode);
+ inode_lock(new_dir_inode);
+ } else {
+ inode_lock(new_dir_inode);
+ inode_lock(dir_inode);
+ }
err = ni_add_name(new_dir_ni, ni, new_de);
if (!err) {
err = ni_remove_name(dir_ni, ni, de, &de2, &undo);
@@ -3042,6 +3054,13 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
* }
*/
+ if (dir_inode == new_dir_inode) {
+ inode_unlock(dir_inode);
+ } else {
+ inode_unlock(dir_inode);
+ inode_unlock(new_dir_inode);
+ }
+
return err;
}
--
Regards,
listout
^ permalink raw reply related [flat|nested] 8+ messages in thread* Forwarded: Add checks for key_len in indx_find
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
2025-11-04 6:06 ` Forwarded: " syzbot
2025-11-04 6:47 ` syzbot
@ 2025-11-10 16:45 ` syzbot
2026-03-19 11:29 ` Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-11-10 16:45 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Add checks for key_len in indx_find
Author: kshitijvparanjape@gmail.com
#syz test
^ permalink raw reply [flat|nested] 8+ messages in thread* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
` (2 preceding siblings ...)
2025-11-10 16:45 ` Forwarded: Add checks for key_len in indx_find syzbot
@ 2026-03-19 11:29 ` syzbot
2026-03-19 15:39 ` syzbot
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2026-03-19 11:29 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: junjie.cao@linux.dev
#syz test
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 2e901d073..c12047153 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2776,6 +2776,8 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
{
int err;
struct NTFS_DE *de2 = NULL;
+ struct ATTR_FILE_NAME *de_name = (struct ATTR_FILE_NAME *)(de + 1);
+ struct ATTR_FILE_NAME *fname;
int undo = 0;
/*
@@ -2789,14 +2791,30 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
* and then can't restore (add) old name.
*/
+ /*
+ * Pre-validate: ensure the old name attribute exists in the MFT
+ * record. On corrupted volumes the attribute may be missing, which
+ * would cause ni_remove_name() to fail after ni_add_name() has
+ * already modified the directory, leaving the inode inconsistent.
+ */
+ mi_get_ref(&dir_ni->mi, &de_name->home);
+ fname = ni_fname_name(ni, (struct le_str *)&de_name->name_len,
+ &de_name->home, NULL, NULL);
+ if (!fname)
+ return -ENOENT;
+
/*
* Way 1 - Add new + remove old.
*/
err = ni_add_name(new_dir_ni, ni, new_de);
if (!err) {
err = ni_remove_name(dir_ni, ni, de, &de2, &undo);
- WARN_ON(err &&
- ni_remove_name(new_dir_ni, ni, new_de, &de2, &undo));
+ if (err &&
+ ni_remove_name(new_dir_ni, ni, new_de, &de2, &undo)) {
+ ntfs_inode_warn(
+ &ni->vfs_inode,
+ "failed to undo rename, inode is inconsistent");
+ }
}
/*
^ permalink raw reply related [flat|nested] 8+ messages in thread* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
` (3 preceding siblings ...)
2026-03-19 11:29 ` Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
@ 2026-03-19 15:39 ` syzbot
2026-03-19 15:48 ` syzbot
2026-03-19 16:31 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2026-03-19 15:39 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: junjie.cao@linux.dev
#syz test
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 2e901d073..c12047153 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2776,6 +2776,8 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
{
int err;
struct NTFS_DE *de2 = NULL;
+ struct ATTR_FILE_NAME *de_name = (struct ATTR_FILE_NAME *)(de + 1);
+ struct ATTR_FILE_NAME *fname;
int undo = 0;
/*
@@ -2789,14 +2791,30 @@ int ni_rename(struct ntfs_inode *dir_ni, struct ntfs_inode *new_dir_ni,
* and then can't restore (add) old name.
*/
+ /*
+ * Pre-validate: ensure the old name attribute exists in the MFT
+ * record. On corrupted volumes the attribute may be missing, which
+ * would cause ni_remove_name() to fail after ni_add_name() has
+ * already modified the directory, leaving the inode inconsistent.
+ */
+ mi_get_ref(&dir_ni->mi, &de_name->home);
+ fname = ni_fname_name(ni, (struct le_str *)&de_name->name_len,
+ &de_name->home, NULL, NULL);
+ if (!fname)
+ return -ENOENT;
+
/*
* Way 1 - Add new + remove old.
*/
err = ni_add_name(new_dir_ni, ni, new_de);
if (!err) {
err = ni_remove_name(dir_ni, ni, de, &de2, &undo);
- WARN_ON(err &&
- ni_remove_name(new_dir_ni, ni, new_de, &de2, &undo));
+ if (err &&
+ ni_remove_name(new_dir_ni, ni, new_de, &de2, &undo)) {
+ ntfs_inode_warn(
+ &ni->vfs_inode,
+ "failed to undo rename, inode is inconsistent");
+ }
}
/*
^ permalink raw reply related [flat|nested] 8+ messages in thread* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
` (4 preceding siblings ...)
2026-03-19 15:39 ` syzbot
@ 2026-03-19 15:48 ` syzbot
2026-03-19 16:31 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2026-03-19 15:48 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: junjie.cao@linux.dev
#syz test: https://github.com/Lukaaa525/linux-kernel.git ntfs3-ni-rename-fix
^ permalink raw reply [flat|nested] 8+ messages in thread* Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
2025-10-30 22:35 [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
` (5 preceding siblings ...)
2026-03-19 15:48 ` syzbot
@ 2026-03-19 16:31 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2026-03-19 16:31 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Author: junjie.cao@linux.dev
#syz test: https://github.com/Lukaaa525/linux-kernel.git ntfs3-ni-rename-fix
^ permalink raw reply [flat|nested] 8+ messages in thread