Skip to content

Commit 2c88c16

Browse files
author
Al Viro
committed
erofs: fix handling kern_mount() failure
if you have a variable that holds NULL or a pointer to live struct mount, do not shove ERR_PTR() into it - not if you later treat "not NULL" as "holds a pointer to object". Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 7e4a205 commit 2c88c16

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/erofs/fscache.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,12 @@ static int erofs_fscache_init_domain(struct super_block *sb)
381381
goto out;
382382

383383
if (!erofs_pseudo_mnt) {
384-
erofs_pseudo_mnt = kern_mount(&erofs_fs_type);
385-
if (IS_ERR(erofs_pseudo_mnt)) {
386-
err = PTR_ERR(erofs_pseudo_mnt);
384+
struct vfsmount *mnt = kern_mount(&erofs_fs_type);
385+
if (IS_ERR(mnt)) {
386+
err = PTR_ERR(mnt);
387387
goto out;
388388
}
389+
erofs_pseudo_mnt = mnt;
389390
}
390391

391392
domain->volume = sbi->volume;

0 commit comments

Comments
 (0)