fs/ntfs3: Fix error handling in ntfs_new_inode()
PATCH 1/1 fs/ntfs3: Fix error handling in ntfs_new_inode()
When memory allocation for mi->mrec fails, ntfs_new_inode() calls iput(). iput() calls ni_write_inode() indirectly, it references uninitialized mi->mrec, and this causes the kernel crash. This patch fixes the issue by making the inode bad before calling iput().
--- fs/ntfs3/fsntfs.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/fsntfs.c +1 -0
@@ -1683,6 +1683,7 @@ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) out:if (err) { +_ntfs_bad_inode (inode);iput (inode); ni =ERR_PTR (err); }
Signature · 1 line
2.39.0
Konstantin Komarov
maintainerQuoted 15 lines · Shigeru Yoshida
When memory allocation for
mi->mrecfails,ntfs_new_inode()callsiput().iput()callsni_write_inode()indirectly, it references uninitializedmi->mrec, and this causes the kernel crash. This patch fixes the issue by making the inode bad before callingiput().Signed-off-by Shigeru Yoshida <[email protected]>--- fs/ntfs3/fsntfs.c | 1 + 1 file changed, 1 insertion(+)fs/ntfs3/fsntfs.c +0
-0
fs/ntfs3/fsntfs.c struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) · line 1689
Quoted 7 lines
fs/ntfs3/fsntfs.c +1
-0@@ -1683,6 +1683,7 @@ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) out:if (err) { +_ntfs_bad_inode (inode);iput (inode); ni =ERR_PTR (err); }
Hello.
This bug have been already fixed by Ye Bin (https://lore.kernel.org/lkml/[email protected]/).
* Thanks for your work.
Hi,
Quoted 25 lines · Konstantin Komarov
Quoted 15 lines · Shigeru Yoshida
When memory allocation for
mi->mrecfails,ntfs_new_inode()callsiput().iput()callsni_write_inode()indirectly, it references uninitializedmi->mrec, and this causes the kernel crash. This patch fixes the issue by making the inode bad before callingiput().Signed-off-by Shigeru Yoshida <[email protected]>--- fs/ntfs3/fsntfs.c | 1 + 1 file changed, 1 insertion(+)fs/ntfs3/fsntfs.c +0
-0fs/ntfs3/fsntfs.c struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) · line 1688
Quoted 6 lines
fs/ntfs3/fsntfs.c +1
-0@@ -1683,6 +1683,7 @@ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) out:if (err) { +_ntfs_bad_inode (inode);iput (inode); ni =ERR_PTR (err); }Hello.
Quoted 1 line
This bug have been already fixed by Ye Bin (https://lore.kernel.org/lkml/[email protected]/).
I've missed the fix you mentioned.
Thank you so much for your reply!
Shigeru
Quoted 3 lines
* Thanks for your work.