Skip to content

Commit 8dae4f6

Browse files
nifeyaalexandrovich
authored andcommitted
fs/ntfs3: Fix NULL dereference in ni_write_inode
Syzbot reports a NULL dereference in ni_write_inode. When creating a new inode, if allocation fails in mi_init function (called in mi_format_new function), mi->mrec is set to NULL. In the error path of this inode creation, mi->mrec is later dereferenced in ni_write_inode. Add a NULL check to prevent NULL dereference. Link: https://syzkaller.appspot.com/bug?extid=f45957555ed4a808cc7a Reported-and-tested-by: syzbot+f45957555ed4a808cc7a@syzkaller.appspotmail.com Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 4f082a7 commit 8dae4f6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/ntfs3/frecord.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,6 +3258,9 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)
32583258
return 0;
32593259
}
32603260

3261+
if (!ni->mi.mrec)
3262+
goto out;
3263+
32613264
if (is_rec_inuse(ni->mi.mrec) &&
32623265
!(sbi->flags & NTFS_FLAGS_LOG_REPLAYING) && inode->i_nlink) {
32633266
bool modified = false;

0 commit comments

Comments
 (0)