From: Al Viro Date: Tue, 13 Feb 2024 03:44:11 +0000 (-0500) Subject: erofs: fix handling kern_mount() failure X-Git-Tag: v6.8-rc6~9^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c88c16dc20e88dd54d2f6f4d01ae1dce6cc9654;p=thirdparty%2Fkernel%2Flinux.git 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 --- diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index bc12030393b24..29ad5b1cc7fde 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -381,11 +381,12 @@ static int erofs_fscache_init_domain(struct super_block *sb) goto out; if (!erofs_pseudo_mnt) { - erofs_pseudo_mnt = kern_mount(&erofs_fs_type); - if (IS_ERR(erofs_pseudo_mnt)) { - err = PTR_ERR(erofs_pseudo_mnt); + struct vfsmount *mnt = kern_mount(&erofs_fs_type); + if (IS_ERR(mnt)) { + err = PTR_ERR(mnt); goto out; } + erofs_pseudo_mnt = mnt; } domain->volume = sbi->volume;