From: syzbot <syzbot+4d8e30dbafb5c1260479@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2)
Date: Thu, 19 Mar 2026 04:29:12 -0700 [thread overview]
Message-ID: <69bbde08.050a0220.227207.0052.GAE@google.com> (raw)
In-Reply-To: <6903e832.050a0220.3344a1.044e.GAE@google.com>
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");
+ }
}
/*
next prev parent reply other threads:[~2026-03-19 11:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-03-19 11:29 ` syzbot [this message]
2026-03-19 15:39 ` Forwarded: Re: [syzbot] [ntfs3?] WARNING in ni_rename (2) syzbot
2026-03-19 15:48 ` syzbot
2026-03-19 16:31 ` 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=69bbde08.050a0220.227207.0052.GAE@google.com \
--to=syzbot+4d8e30dbafb5c1260479@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--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