Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp697182ybz; Fri, 1 May 2020 07:01:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJweKH0XbDKZ+kYQh4nlRxhYW3Any5w2mDT/RcD1fcUUIkBxcOzN9rQ5A0qnMUzjb+rGnWt X-Received: by 2002:a17:906:1a06:: with SMTP id i6mr3286294ejf.90.1588341661297; Fri, 01 May 2020 07:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588341661; cv=none; d=google.com; s=arc-20160816; b=DoUlmTd3avQLKHY2tFLXwAX6tz19gtkz23ceqllGFUvLrs2f+GQ//pA5wKBMox/r3i V1rBWXbex6WWyOywXym237nUn+V+4poZKSyQdHtR/Hy3Es10wvNXhVEUKxDohAx0Ry/e 33NWSvtFCas0xToIcaycsfcnf//rvymgoWj9QTvC7xMpiDVTUjWCA1kYUTsHqpXnW2az pEUCi3suFtdmAepEJBqJem3F+MsdsXANkjKop+m7FsZNRfKTpVEXpK/4KWn//11zxBgI yosNvcANznigx9N3fmFg8kOryKzV28VhLzeg+tusCaypXECeAH0zehn1gw60g5Pt/9+M wOPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XE+tpLkeZlYOKXENul9F8uJmbNO68+WOKbhoAHkdCaI=; b=IeLM6wcndZ7J31RodrZXVZuxs3vPz6d2jmYQPgOrcEGioCXp2reJg4D7FQhDXxxXwk 4+a1WAYvaGwPvUC6rncEnQOzQiGmvV6Uj2ltGjtz4PeJx2bBdyiB0rjSG45uofw6cZt3 Xv9gEk2KER2mHMQ1L9Mi/m84nYuzRpu8YHZ+0MdAanZ5BeK85jMSvtCjjghDilJjlbBU VQjV9cXLdjI4sO+jsg2B409qMaC//MJLLPgMOTXPLmnNcfLcH4c5Fv2fR6BcdHUT/wCr ErbdbTpO0OHnRF6bhKAeWerZDrCpXpVZO4SCNJGTZ3SmsrnAD1asYkfhNFYZTnf6p30p 7JzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J2cXFu5C; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nh7si1715790ejb.182.2020.05.01.07.00.37; Fri, 01 May 2020 07:01:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=J2cXFu5C; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728981AbgEAN6Y (ORCPT + 99 others); Fri, 1 May 2020 09:58:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729481AbgEANac (ORCPT ); Fri, 1 May 2020 09:30:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1AAD20757; Fri, 1 May 2020 13:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339832; bh=0bmmoobu5JO6/P+JWnOrpzSDyd+b/gmKezvE5yBlgME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J2cXFu5C14nqwQjuEgp98LYViXiU3pRpUToCyd+Zv+WEgzlEPxo/gUmsDl+8SYZhx qFRjSRx+uQVGds59DxYX2iEFe32nOpJtNf+n5hLLhk1odsb3iyVIOU/0y6R4SkAene xQGKYbMi6DzS/lCrjxK+ebNqUhIP7bNRk3XCHzDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arthur Marsh , Theodore Tso , Ashwin H Subject: [PATCH 4.9 78/80] ext4: fix block validity checks for journal inodes using indirect blocks Date: Fri, 1 May 2020 15:22:12 +0200 Message-Id: <20200501131537.532578814@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131513.810761598@linuxfoundation.org> References: <20200501131513.810761598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Greg Kroah-Hartman --- fs/ext4/block_validity.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -274,6 +274,11 @@ int ext4_check_blockref(const char *func __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 &&