From: Konstantin Komarov Date: Thu, 26 May 2022 09:51:03 +0000 (+0300) Subject: fs/ntfs3: Fix missing i_op in ntfs_read_mft X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c293e8abc09e6e1faa50d967bd8862b1cbd575e5;p=linux.git fs/ntfs3: Fix missing i_op in ntfs_read_mft commit 37a530bfe56ca9a0d3129598803f2794c7428aae 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: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Reported-by: Liangbin Lian Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 879952254071f..b2cc1191be695 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -430,6 +430,7 @@ end_enum: } 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;