From patchwork Fri Jul 9 13:20:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472274 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, 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 5B8DFC07E9E for ; Fri, 9 Jul 2021 13:22:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 403F561377 for ; Fri, 9 Jul 2021 13:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232631AbhGINYn (ORCPT ); Fri, 9 Jul 2021 09:24:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:56166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232701AbhGINY2 (ORCPT ); Fri, 9 Jul 2021 09:24:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DC4A8613BC; Fri, 9 Jul 2021 13:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1625836905; bh=Sikym0kdgw7dT7cDHmDWw/WDEsb9PTkWnAYLN3Ac+XI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MAvPNgh/dkTi1vEM7FqdaX72/XQRAuD7whf1MTkzEyPiAYxT5yVgWBs13Q9KzsORP 8sjx+ov5VRFBxf2rQ+/CnV/n1T+GI+0LQegx9TObTpyqHtvXbmF1ftYMRxgFnq9rdU 5lsk8IBNYvGrK6mZxbc5thuCCAAFzYkMvJQUCtpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tahsin Erdogan , Jan Kara Subject: [PATCH 4.19 24/34] ext4: eliminate bogus error in ext4_data_block_valid_rcu() Date: Fri, 9 Jul 2021 15:20:40 +0200 Message-Id: <20210709131657.520194374@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210709131644.969303901@linuxfoundation.org> References: <20210709131644.969303901@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tahsin Erdogan Mainline commit ce9f24cccdc0 ("ext4: check journal inode extents more carefully") enabled validity checks for journal inode's data blocks. This change got ported to stable branches, but the backport for 4.19 has a bug where it will flag an error even when system block entry's inode number matches journal inode. The way error is reported is also problematic because it updates the superblock without following journaling rules. This may result in superblock checksum errors if the superblock is in the process of being committed but has a previously calculated checksum that doesn't include the bogus error update. This patch eliminates the bogus error by trying to match how other backports were implemented, which is to flag an error only when inode numbers mismatch. Fixes: commit a75a5d163857 ("ext4: check journal inode extents more carefully") Signed-off-by: Tahsin Erdogan Cc: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/ext4/block_validity.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -171,8 +171,10 @@ static int ext4_data_block_valid_rcu(str else if (start_blk >= (entry->start_blk + entry->count)) n = n->rb_right; else { + if (entry->ino == ino) + return 1; sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); - return entry->ino == ino; + return 0; } } return 1;