Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1033848ybz; Wed, 29 Apr 2020 13:47:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJO30i/y6YjZpaaeRIoEjot8LXXUwn2WV67pFHVbKM1oGMM3ZCEf7Z6DzXCZMKafcw3cUlT X-Received: by 2002:a17:907:447f:: with SMTP id oo23mr4304671ejb.274.1588193279131; Wed, 29 Apr 2020 13:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588193279; cv=none; d=google.com; s=arc-20160816; b=zCb8TKtVvpA0ujFy7vPky5LJpXSm2NCY5KykJysP29/cPSX+I1SogyKptITP6BbKGW TL6nSXk+jwjNh807g6gq9dXtO+25jxe8CBxSQQIsKxAYAfmj0IbFY/zDmWe0sHixtAvU AXgnxC/etcn/+0pKe2y2K6TSivbCYd+S2RugeQeaM/tw2A12lI9gdWZYa7xUz+TyX4NP U4es1yREpOF/oPasP0F0iIPTaIw9X7cc21xwlP6xSi3v0n/2UY0nK0jhxJb1cwSZva7w oftaQq40f0xCn3Zk7vKwD4d32rVwE3UsY6te6wszyGoKvlqYKZqsbqMEjvqcOvPIwFyY Fd8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=9LxwxrvbnpIrRbbRnDhpjN2F9Rhc4Q+vFIlUc8+aKBg=; b=jBc3wfKQ1xi2AhLzWtqIiBdVi0FUmHUvfGrjbo6GabEYJxIHlNbOWOmhWKCjoWnFzt +EhP1Lpyun6bvK/+q2JsEXGl3le9Sol0sE8t0A3NAF1DUJ5WqBKZP+PawgES8Kp44LGs 84U5VGyu+L4H9XfIMEOI508b4OFX91E2HcXmExcrCGK18GbgrBqrWyaZAt3VR3xmQZRC 4DSTpAUR1bm6pg2ryqJ/cxGeNp2IRLAfHH+1NcXPsmU+Y81+kGfAsEpJGMwbAPJ2IQej BwZ3l91VBeTbe8YCitjJVjJGJ0HGlmjrDV3Kva7BmfY7JQHyS8tlB/6/Fvdp6sD6SrTq 1Jdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si3947526eds.461.2020.04.29.13.47.35; Wed, 29 Apr 2020 13:47:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgD2Uq7 (ORCPT + 99 others); Wed, 29 Apr 2020 16:46:59 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:26956 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbgD2Uq6 (ORCPT ); Wed, 29 Apr 2020 16:46:58 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 29 Apr 2020 13:46:54 -0700 Received: from localhost.localdomain (ashwinh-vm-1.vmware.com [10.110.19.225]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id F3E9040A68; Wed, 29 Apr 2020 13:46:53 -0700 (PDT) From: ashwin-h To: , CC: , , , , , , , , , Ashwin H Subject: [PATCH 4/5] ext4: fix block validity checks for journal inodes using indirect blocks Date: Thu, 30 Apr 2020 10:05:20 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: ashwinh@vmware.com does not designate permitted sender hosts) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Theodore Ts'o commit 170417c8c7bb2cbbdd949bf5c443c0c8f24a203b upstream. Commit 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity") failed to add an exception for the journal inode in ext4_check_blockref(), which is the function used by ext4_get_branch() for indirect blocks. This caused attempts to read from the ext3-style journals to fail with: [ 848.968550] EXT4-fs error (device sdb7): ext4_get_branch:171: inode #8: block 30343695: comm jbd2/sdb7-8: invalid block Fix this by adding the missing exception check. Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity") Reported-by: Arthur Marsh Signed-off-by: Theodore Ts'o Signed-off-by: Ashwin H --- fs/ext4/block_validity.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 093639b..3f3d82d 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -274,6 +274,11 @@ int ext4_check_blockref(const char *function, unsigned int line, __le32 *bref = p; unsigned int blk; + if (ext4_has_feature_journal(inode->i_sb) && + (inode->i_ino == + le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) + return 0; + while (bref < p+max) { blk = le32_to_cpu(*bref++); if (blk && -- 2.7.4