Skip to content

Commit

Permalink
fs/ntfs3: Fix missing i_op in ntfs_read_mft
Browse files Browse the repository at this point in the history
commit 37a530b upstream.

There is null pointer dereference because i_op == NULL.
The bug happens because we don't initialize i_op for records in $Extend.
Fixes: 82cae26 ("fs/ntfs3: Add initialization of super block")

Reported-by: Liangbin Lian <[email protected]>
Signed-off-by: Konstantin Komarov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
aalexandrovich authored and gregkh committed Aug 25, 2022
1 parent efdcf4d commit c293e8a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/ntfs3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
} else if (fname && fname->home.low == cpu_to_le32(MFT_REC_EXTEND) &&
fname->home.seq == cpu_to_le16(MFT_REC_EXTEND)) {
/* Records in $Extend are not a files or general directories. */
inode->i_op = &ntfs_file_inode_operations;
} else {
err = -EINVAL;
goto out;
Expand Down

0 comments on commit c293e8a

Please sign in to comment.