From patchwork Mon Jul 12 06:12:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 475596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68CAAC11F76 for ; Mon, 12 Jul 2021 07:30:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E28961248 for ; Mon, 12 Jul 2021 07:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241607AbhGLHcz (ORCPT ); Mon, 12 Jul 2021 03:32:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345220AbhGLH3m (ORCPT ); Mon, 12 Jul 2021 03:29:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B14E86162D; Mon, 12 Jul 2021 07:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074773; bh=yDKKkLbLvZHkjEhLE8CA+rE3DY6EHc3b7WO5+7l+mkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eX2OTJbQAQUVHhc5r2i06sNbZibLuitPu8KWF8sVjKbQEshceBciGSIWPPQ16mgji yzQNL8UHe9DG8Z+lZR2jVJchgpWl81IluAeC5vY0o9RmUjKUkFY2CT1pjmO5H2Jgwu fhfbDu3UW/R/KrRTAOdP9KhgZPIJDuM3dC7yXPyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Gao Xiang , Chao Yu Subject: [PATCH 5.12 692/700] erofs: fix error return code in erofs_read_superblock() Date: Mon, 12 Jul 2021 08:12:55 +0200 Message-Id: <20210712061049.579863117@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wei Yongjun 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 --- fs/erofs/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -155,6 +155,7 @@ static int erofs_read_superblock(struct goto out; } + ret = -EINVAL; blkszbits = dsb->blkszbits; /* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ if (blkszbits != LOG_BLOCK_SIZE) {