From: Wei Yongjun Date: Wed, 19 May 2021 14:16:57 +0000 (+0000) Subject: erofs: fix error return code in erofs_read_superblock() X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=51c19f4a62129bca096df760c7690833958ce9cf;p=linux-block.git erofs: fix error return code in erofs_read_superblock() commit 0508c1ad0f264a24c4643701823a45f6c9bd8146 upstream. 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true, thus 0 will return in some error handling cases. Fix to return negative error code -EINVAL instead of 0. Link: https://lore.kernel.org/r/20210519141657.3062715-1-weiyongjun1@huawei.com Fixes: b858a4844cfb ("erofs: support superblock checksum") Cc: stable # 5.5+ Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/erofs/super.c b/fs/erofs/super.c index d5a6b9b888a5..f31a08d86be8 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -155,6 +155,7 @@ static int erofs_read_superblock(struct super_block *sb) goto out; } + ret = -EINVAL; blkszbits = dsb->blkszbits; /* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ if (blkszbits != LOG_BLOCK_SIZE) {