mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
fs/ntfs3: Fix root inode checking
Separate checking inode->i_op and inode itself. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/202302162319.bDJOuyfy-lkp@intel.com/ Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
e43f6ec224
commit
788ee1605c
@ -1347,12 +1347,21 @@ load_root:
|
|||||||
ref.low = cpu_to_le32(MFT_REC_ROOT);
|
ref.low = cpu_to_le32(MFT_REC_ROOT);
|
||||||
ref.seq = cpu_to_le16(MFT_REC_ROOT);
|
ref.seq = cpu_to_le16(MFT_REC_ROOT);
|
||||||
inode = ntfs_iget5(sb, &ref, &NAME_ROOT);
|
inode = ntfs_iget5(sb, &ref, &NAME_ROOT);
|
||||||
if (IS_ERR(inode) || !inode->i_op) {
|
if (IS_ERR(inode)) {
|
||||||
err = PTR_ERR(inode);
|
err = PTR_ERR(inode);
|
||||||
ntfs_err(sb, "Failed to load root (%d).", err);
|
ntfs_err(sb, "Failed to load root (%d).", err);
|
||||||
goto out;
|
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);
|
sb->s_root = d_make_root(inode);
|
||||||
if (!sb->s_root) {
|
if (!sb->s_root) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user