[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_706EA97643BAE446F774577CA6D6536A0305@qq.com>
Date: Sun, 2 Jun 2024 17:56:54 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+5d34cc6474499a5ff516@...kaller.appspotmail.com
Cc: almaz.alexandrovich@...agon-software.com,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
ntfs3@...ts.linux.dev,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] fs/ntfs3: dealing with situations where dir_search_u may return null
If hdr_find_e() fails to find an entry in the index buffer, dir_search_u() maybe
return NULL.
Therefore, it is necessary to add relevant judgment conditions in ntfs_lookup().
Reported-and-tested-by: syzbot+5d34cc6474499a5ff516@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
fs/ntfs3/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index 084d19d78397..293c37171d97 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -93,7 +93,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,
* If the MFT record of ntfs inode is not a base record, inode->i_op can be NULL.
* This causes null pointer dereference in d_splice_alias().
*/
- if (!IS_ERR_OR_NULL(inode) && !inode->i_op) {
+ if (IS_ERR_OR_NULL(inode) || !inode->i_op) {
iput(inode);
inode = ERR_PTR(-EINVAL);
}
--
2.43.0
Powered by blists - more mailing lists