Commit 788ee160 authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Fix root inode checking

Separate checking inode->i_op and inode itself.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202302162319.bDJOuyfy-lkp@intel.com/Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent e43f6ec2
......@@ -1347,12 +1347,21 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
ref.low = cpu_to_le32(MFT_REC_ROOT);
ref.seq = cpu_to_le16(MFT_REC_ROOT);
inode = ntfs_iget5(sb, &ref, &NAME_ROOT);
if (IS_ERR(inode) || !inode->i_op) {
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
ntfs_err(sb, "Failed to load root (%d).", err);
goto out;
}
/*
* Final check. Looks like this case should never occurs.
*/
if (!inode->i_op) {
err = -EINVAL;
ntfs_err(sb, "Failed to load root (%d).", err);
goto put_inode_out;
}
sb->s_root = d_make_root(inode);
if (!sb->s_root) {
err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment