aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/erofs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-01-23 14:12:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-25 09:52:02 +0100
commit94832d93992176b7c37672e1fc7b7acc16e70286 (patch)
tree9a4708ad1b3c97ab226accb473078bd627e0b1b3 /drivers/staging/erofs
parentstaging: ks7010: remove unnecessary parentheses (diff)
downloadlinux-dev-94832d93992176b7c37672e1fc7b7acc16e70286.tar.xz
linux-dev-94832d93992176b7c37672e1fc7b7acc16e70286.zip
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>
Diffstat (limited to 'drivers/staging/erofs')
-rw-r--r--drivers/staging/erofs/super.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index af5140eede18..176fca2af379 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -421,13 +421,14 @@ static int erofs_read_super(struct super_block *sb,
errln("rootino(nid %llu) is not a directory(i_mode %o)",
ROOT_NID(sbi), inode->i_mode);
err = -EINVAL;
- goto err_isdir;
+ iput(inode);
+ goto err_iget;
}
sb->s_root = d_make_root(inode);
if (sb->s_root == NULL) {
err = -ENOMEM;
- goto err_makeroot;
+ goto err_iget;
}
/* save the device name to sbi */
@@ -453,10 +454,6 @@ static int erofs_read_super(struct super_block *sb,
*/
err_devname:
dput(sb->s_root);
-err_makeroot:
-err_isdir:
- if (sb->s_root == NULL)
- iput(inode);
err_iget:
#ifdef EROFS_FS_HAS_MANAGED_CACHE
iput(sbi->managed_cache);