Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp667930ybz; Fri, 1 May 2020 06:30:17 -0700 (PDT) X-Google-Smtp-Source: APiQypJmno2TIAaoV6OfF48D/LGhqne0Gvv2JDh8wgWEZZy/9QW2LnneLYH6Lx3PYWkbqkQPBX9i X-Received: by 2002:aa7:d685:: with SMTP id d5mr3296220edr.340.1588339816827; Fri, 01 May 2020 06:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588339816; cv=none; d=google.com; s=arc-20160816; b=EEgbraN35WG89K9MxTTcuJaJIHqB4bMJIQcDfnUomSghTKXxjaYODPD0hvsXBLbtOo EMxSYkd1rGeX+WUvH1R5uy+GhWR7Nx3TRo56oLvM0U9ImpvnWmOrpGv5WE50eS5yFM27 SG7Kjd6yT0qcbVqF5t/l4X4xRRPTEz1UmmsEdszYYYuFpI40hOFuZwrqlblNPQsryYw0 bdne3zad5bbuY8niALFObo28CPPk+7MEqhBKiKlQIc56aflTmiNfpgcHMfdC2qxklVrP gWXfyGBuPkouaU7KhKoZTVH+ep9CEWfZqxJJ4PSAVdFywFJTxJG4H/tF6uYv4ChD84IU G+hw== 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=k0iIZMeyDjSUENuo4u5/KDVT5mKprLrVvTcUwrRQ4KXQalThXEIvqm7Nt7UQlUzw44 k0h8Ta1d2kXzobZtQQWLJmV2CW1ioVCbgQjeM723UgR9w0o2pNxv05Mhny4IMgU5ooJ8 xhmTEXhMUO4ecs9IpkQNeNn8+2Zp2S5jpnsBSt47qtlLxbZQZNU1Cye9tHjmH3RcOGM5 h/wglZze8tYTsuQKivccIU6H9ytP7VbSpJpOcpTzn9x9sJ+6F5FzA5GWhoXZ1/Ru4tXc SATnZhbVAsDur+C5Yiw+GoipsN1t2TaI702i0Jo1tXFmMAHURPSPHsaN/DSVUoEXAMll 21fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qdp1eN8b; 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 u7si1638527ejr.522.2020.05.01.06.29.53; Fri, 01 May 2020 06:30:16 -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=Qdp1eN8b; 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 S1729503AbgEAN1j (ORCPT + 99 others); Fri, 1 May 2020 09:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:49970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729488AbgEAN1g (ORCPT ); Fri, 1 May 2020 09:27:36 -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 B0D92208D6; Fri, 1 May 2020 13:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339655; bh=0bmmoobu5JO6/P+JWnOrpzSDyd+b/gmKezvE5yBlgME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qdp1eN8bcbEHwdfNTll6ki+qD3t1uw2CpOGs1Ou/4rzgyiIGdbessqVgqducEPxGi RJOcYUB6Uy0Wim9uwuMUH8dGxkEYmzck95KSonY+SEAkCSSlz7p1COgpRduO+QOZ7S TLOIbK8rZ0hl7jWKXMyAT4aJpcVj8kQgHKzIf3/s= 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.4 69/70] ext4: fix block validity checks for journal inodes using indirect blocks Date: Fri, 1 May 2020 15:21:57 +0200 Message-Id: <20200501131534.862556194@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131513.302599262@linuxfoundation.org> References: <20200501131513.302599262@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 &&