lkml.org 
[lkml]   [2023]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fs/ntfs3: Fix error handling in ntfs_new_inode()
Date
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().

Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
fs/ntfs3/fsntfs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 567563771bf8..7b93f2aeb6f6 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -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);
}
--
2.39.0
\
 
 \ /
  Last update: 2023-03-26 23:27    [W:0.038 / U:0.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site