Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp277566yba; Mon, 20 May 2019 08:32:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOILPlvQa8s12OTSFPsXmPItAW7q0uuMuImc8wKS5jqZAidRzStCa5mLcwMZb5raW9rAaD X-Received: by 2002:a17:902:12f:: with SMTP id 44mr30258137plb.137.1558366375467; Mon, 20 May 2019 08:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558366375; cv=none; d=google.com; s=arc-20160816; b=tPXXJgMgopELIej5CoZpXkBTXprNcBxBQmW2Txoz/q0C7BCfEQL193XGzomOM50GRw 1+bGNuT3GG9Rv67JbKtz26TIc6QHy3nZJq1yfj408DUmrIHSkhs/7b57asB4M8BETdMH iigMCXBtJ8FY69krrymRdnQvnL8lq7ncrg/NcDVTweS8e+v/Z6PWaUBl4rgKtrjcYnzm +CCj4j1j/jHJw/4u/D5jThypHR42ptoIHWOWHnShXyajAtg3abfnM2I6Wfw/+Y2ifYlz V3bNoNjAIMu4IsKYG7HSSyLN24MaTfnfDDsxKLsKbWr3oXnpTm1Jqh7Smjb4zrDz6EvU o5yQ== 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=9rznv6jOW9THnlat4wTjUSLW1twarfhIOzdeLA+r3Fc=; b=Oe7O0Gu72rQQ264Zd+CPhjKvZTuypoDInwb63VBNmVCpLSKL05kvr80M2D4b0prYVH Z9OeIEtDdkIlpCOwWc2dlsu4V5G4imY/3GAw0XbtA60uJ8/xVrlHjriqI68GbSNX/h0H HnT0HsqKoH0Sd38lVHZrRPtrvne1b3h8aecRiA66ii7kf1suSo48tbv+OHvOJYIJv+4r M2LkM/aDv/cbWFCzh9/M+vrjlnMbuSejaMCjrzcw36Z3pW9qedKWpXLX6pRmMMx5iXfu 6A4AVT279Mw8AoOIbqr635lICDLrSNS2Cd3UNnHHJ4i806MLMnduzLpT2nynqv6wWgJG UBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OaY5FlHF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si13427130plw.163.2019.05.20.08.32.40; Mon, 20 May 2019 08:32:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OaY5FlHF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389032AbfETMZR (ORCPT + 99 others); Mon, 20 May 2019 08:25:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:40288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389015AbfETMZP (ORCPT ); Mon, 20 May 2019 08:25:15 -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 2167E20645; Mon, 20 May 2019 12:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355114; bh=5zCdNk6o7TvfEzmsRexz2WXo2rRTLCTto/KnK33XGaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OaY5FlHFNieQjDACbYlw53UkCR6g11OO3pQ1+nf4icSqUhsNnUJGrnXLUpuBMUvgo b19bbRRSXiTQWt1DdAXW7ThxLqr+lx8OvLrE/cw+N3Pl09IScjpeJX0VFWRU7IMlkQ euL/cs83Ee/52LoKx1ftDtti6Z5AVCvSm3Gj1R+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arthur Marsh , Theodore Tso Subject: [PATCH 4.19 103/105] ext4: fix block validity checks for journal inodes using indirect blocks Date: Mon, 20 May 2019 14:14:49 +0200 Message-Id: <20190520115254.348194358@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@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: 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 @@ -276,6 +276,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 &&