From: Al Viro viro@zeniv.linux.org.uk
mainline inclusion from mainline-v6.8-rc6 commit 2c88c16dc20e88dd54d2f6f4d01ae1dce6cc9654 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
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 Conflicts: fs/erofs/fscache.c [Context differences.] Signed-off-by: Zizhi Wo wozizhi@huawei.com Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/erofs/fscache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index d42a583ff6b1..70b96377fcb6 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -355,11 +355,13 @@ static int erofs_fscache_init_domain(struct super_block *sb) goto out;
if (!erofs_pseudo_mnt) { - erofs_pseudo_mnt = kern_mount(&erofs_anon_fs_type); - if (IS_ERR(erofs_pseudo_mnt)) { - err = PTR_ERR(erofs_pseudo_mnt); + struct vfsmount *mnt = kern_mount(&erofs_anon_fs_type); + + if (IS_ERR(mnt)) { + err = PTR_ERR(mnt); goto out; } + erofs_pseudo_mnt = mnt; }
domain->volume = sbi->volume;