Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp1389817rdb; Fri, 25 Aug 2023 23:55:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIgYwgpQnAQ0zQffsM4njYLgnc85/g23WL8XLI+GxzygWjRlj7BVvNjxUejiYHCSW7APof X-Received: by 2002:a05:6358:5e0f:b0:134:f326:e819 with SMTP id q15-20020a0563585e0f00b00134f326e819mr20083423rwn.29.1693032943797; Fri, 25 Aug 2023 23:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693032943; cv=none; d=google.com; s=arc-20160816; b=N0u66WEVS4CWOnHYjTYzy81F/vgvKPhUu1juDil+xJm7hmdRH2NySGd23X8m/H4LUU CH2FxgSU2RLWvDP0G6Mtw+uVQKQJA6E4ygIrgJbIZ0XgfWKMO1lS8iukuYr+MqeUb790 KlgOw7vNWQAIf7Da3rwlYDqrf1NYeV8+e0yUMSNPwco/St7JUUL2mnjvnl2omMavKKIT DzeFAVSRlKxVZX2DEU4Eh/gBUy3Nd8p27KHPIPRglqSfs5u38ZBF3FSCNIgDERGjp9+v QauafDIOC5zRBxQ8AXlvK6ffJu+tf4+7L2LbOaJpd0Ope+FJjbR1q187DlMcPiNJAsTl ykiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BH3jBimWCrQHhbDfaLaALx3avT9nVV0RB3wcB6DnP98=; fh=Uq/HK0tePPZ4uFSrjmAoQ+8fm8HBRKIYZPcFTEYnhm4=; b=NGsVdQ8Wmw1Jr//R8GE1WDLPspYV0Y9KxfA51Rmh6+5ggupgfRa2u8Dz+1uvo8+xwV O2zhLtxW8/3TG1sGvt8pWyXpgLXp+J7EABSop2pfBiEd3mXj8mdrsHBi3gz0CIyyC+cP 4BIY/wuSA8+YzaFhnfBbpU9DO56Rn1RJhYc/Az2o5BkwcLEE+3qFRShbHgOR2+LMJjiX D6/70YCgHdJt00n1QKZ//92BDLqEz4wFxx+d67xU3DAjhxBldU9kVUWi2CAuHrC3Ehvh TOhVJM68RMHHbR4pxBjK5kliGNVppB1fyTxvOjx0jME4VCqikKjLiSlzzur/sjZ/LeMM RLLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt4-20020a170903088400b001b8a6bf59cfsi3156461plb.378.2023.08.25.23.55.04; Fri, 25 Aug 2023 23:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbjHZBP1 (ORCPT + 99 others); Fri, 25 Aug 2023 21:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231614AbjHZBOz (ORCPT ); Fri, 25 Aug 2023 21:14:55 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8DE212B for ; Fri, 25 Aug 2023 18:14:52 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RXf4T12W9z4f3kkJ for ; Sat, 26 Aug 2023 09:14:49 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP2 (Coremail) with SMTP id Syh0CgDnC3ADUulkGXVSBg--.63263S4; Sat, 26 Aug 2023 09:14:49 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH] ext4: correct error handling of ext4_get_journal_inode() Date: Sat, 26 Aug 2023 09:10:29 +0800 Message-Id: <20230826011029.2023140-1-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgDnC3ADUulkGXVSBg--.63263S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Jry5AF48AFW5ZFy8AFyrJFb_yoWkCFb_GF 48Jw4xXrs3Jrs2939YkF15Zr4Fvan29r1rWas3twsFgFWYqF1kGF4kCr1rAF1rWr4rKrn8 Cwn7tFyfKFykujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxAIw28IcxkI7VAKI48J MxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4 v20xvaj40_WFyUJVCq3wCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E 14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x0JUp6wZUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zhang Yi Commit '99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value")' changed ext4_get_journal_inode() to return error return value when something bad happened, but missed to modify the caller ext4_calculate_overhead(), so fix it. Reported-by: syzbot+b3123e6d9842e526de39@syzkaller.appspotmail.com Fixes: 99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value") Signed-off-by: Zhang Yi --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bb42525de8d0..91f20afa1d71 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4260,7 +4260,7 @@ int ext4_calculate_overhead(struct super_block *sb) else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) { /* j_inum for internal journal is non-zero */ j_inode = ext4_get_journal_inode(sb, j_inum); - if (j_inode) { + if (!IS_ERR(j_inode)) { j_blocks = j_inode->i_size >> sb->s_blocksize_bits; overhead += EXT4_NUM_B2C(sbi, j_blocks); iput(j_inode); -- 2.39.2