mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 02:36:53 +07:00
staging: erofs: fix potential double iput in erofs_read_super()
Some error cases like failing from d_make_root() will cause double iput because d_make_root() also does iput in its error path. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Reviewed-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
45a50ab1d6
commit
94832d9399
@ -421,13 +421,14 @@ static int erofs_read_super(struct super_block *sb,
|
|||||||
errln("rootino(nid %llu) is not a directory(i_mode %o)",
|
errln("rootino(nid %llu) is not a directory(i_mode %o)",
|
||||||
ROOT_NID(sbi), inode->i_mode);
|
ROOT_NID(sbi), inode->i_mode);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto err_isdir;
|
iput(inode);
|
||||||
|
goto err_iget;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb->s_root = d_make_root(inode);
|
sb->s_root = d_make_root(inode);
|
||||||
if (sb->s_root == NULL) {
|
if (sb->s_root == NULL) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_makeroot;
|
goto err_iget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the device name to sbi */
|
/* save the device name to sbi */
|
||||||
@ -453,10 +454,6 @@ static int erofs_read_super(struct super_block *sb,
|
|||||||
*/
|
*/
|
||||||
err_devname:
|
err_devname:
|
||||||
dput(sb->s_root);
|
dput(sb->s_root);
|
||||||
err_makeroot:
|
|
||||||
err_isdir:
|
|
||||||
if (sb->s_root == NULL)
|
|
||||||
iput(inode);
|
|
||||||
err_iget:
|
err_iget:
|
||||||
#ifdef EROFS_FS_HAS_MANAGED_CACHE
|
#ifdef EROFS_FS_HAS_MANAGED_CACHE
|
||||||
iput(sbi->managed_cache);
|
iput(sbi->managed_cache);
|
||||||
|
Loading…
Reference in New Issue
Block a user