From: Shigeru Yoshida <syoshida@redhat.com>
To: almaz.alexandrovich@paragon-software.com
Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
Shigeru Yoshida <syoshida@redhat.com>
Subject: [PATCH] fs/ntfs3: Fix error handling in ntfs_new_inode()
Date: Wed, 4 Jan 2023 21:39:02 +0900 [thread overview]
Message-ID: <20230104123902.978084-1-syoshida@redhat.com> (raw)
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
next reply other threads:[~2023-01-04 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 12:39 Shigeru Yoshida [this message]
2023-01-13 9:44 ` [PATCH] fs/ntfs3: Fix error handling in ntfs_new_inode() Konstantin Komarov
2023-01-16 8:33 ` Shigeru Yoshida
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=20230104123902.978084-1-syoshida@redhat.com \
--to=syoshida@redhat.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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