Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1023178ybz; Wed, 29 Apr 2020 13:36:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJ59J6sGcsOXGRmUHCp64Z9FJJ42An+GoX+nmQ2ShBuGppYQtVt2hw/IhTv+lxn8aX0bMJU X-Received: by 2002:a17:906:c7c5:: with SMTP id dc5mr4467691ejb.50.1588192573275; Wed, 29 Apr 2020 13:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588192573; cv=none; d=google.com; s=arc-20160816; b=dE4n87OCTTegyCKgCM/bipWeW5xEsj/G7lpbkiOWqkWpi1CFi93DuSXfOSbJc8LpU6 psDQuP7MDDv2UycnSB1mFlK+s7/k4pynI/NhXIn6Njm/wd/FGZNL+D0FmRTVF0nquDmh C/+DJuIv9utTCQBGgks9atYyhfGcXa4dvIDjkYmwuM5BazhtRWjhwJ8V4sJ8MsM3w/9O NvdWr1AYYQkyS0cgxKBFdIkAInlyXFrVIh2/y0vfZr04m6iUwyF/jBAuHd2PHpBWjtuF g8wTc3m8aC3y4SrjnHZ2bwDwGy4GgKKuoEKLfS49ANR+3ysCIqMJLTwi0m3U3bNY6Qa6 wbCQ== 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=QvLmaW6Lg29/ZFKcj/RpqiCjjhILJVRyt2ivvrXUzmU=; b=IZYpRnrT/ZDKHXQ1zM6eWf+aKEXbshAosBhuhKiMbsBT7nfdVEmszxBaNXLb1YIJ06 Qo8hpougAHGBpmg1wsQCQ68JGSf/CEmTNQdmgmaSM7eMkoUlsjfP13sEqqai/OfN6NUI 5AK/iO1eM8pCH0Q5TYG87wKMPKdFLLorDQMYva4USM/rEwSD5ZxhwAoOp14bD7J7Tfc5 DK6gnQCuah9DuYeFJZ1ZJAbmSLG946TBIxIWYfGGX+bcTW1MHbVd/LBHEfrioMF42CUZ a9jPLrmQsqvi88Krv5XNqa2ZcJnTXABggWzK5G4iCnorUBTh5ArAZjVbe0PAhbNR9Fnt Am2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 u2si4856415edp.153.2020.04.29.13.35.49; Wed, 29 Apr 2020 13:36:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727101AbgD2Udp (ORCPT + 99 others); Wed, 29 Apr 2020 16:33:45 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:13804 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727095AbgD2Udo (ORCPT ); Wed, 29 Apr 2020 16:33:44 -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:33:40 -0700 Received: from localhost.localdomain (ashwinh-vm-1.vmware.com [10.110.19.225]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 520D740F60; Wed, 29 Apr 2020 13:33:40 -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 09:52:06 +0530 Message-ID: <635145d00af4aa62ac233f754188b8c76f54d955.1588189373.git.ashwinh@vmware.com> 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 2370dfd..7ba8920 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -275,6 +275,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