Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp297765ybm; Wed, 22 May 2019 03:23:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoTcHzS/NLAdQ9J2mprsvbptrRhEHm3BKgavTIqyHXfJGK1VsTwkBQt0vNBt6mAq64F7ex X-Received: by 2002:a62:ac0a:: with SMTP id v10mr94785889pfe.57.1558520615890; Wed, 22 May 2019 03:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558520615; cv=none; d=google.com; s=arc-20160816; b=SaCV+2gWQZPsl7PkbJ4D2eOsiVbnjToXWar2fcc1kcg2cTpSSlbwcs0N8adygT8ji1 2FDnP+3Ky5pd2IACTx3soo4u5X3UWFZLginLD/PdMEEYCUxX4ES5s+1qvQ0m5rVLZEOk z0pVvVXSFgJjjGWbKYfQVNUuDA3EtcaLFBU1KAq7E28LxT9QWhoCuBguA5UcRoba+NDf aoRgKFDWrGfBWCivbHFYKHNATgZmU8l86/EST+9kSPzEIHW2mgrIy0N9s/bau0z1Ci7c 9N10I0NGH4NXRYLhJQvYWuJCVWnOly4ElT/4nKFfztJI+IFY0oIpYsGD1ymG1kDZK/6Q ugOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ego/F8lThdbc9fp9mLmB72DbjNU+MgAm6FuwcMkTfLM=; b=JJ06GT14lMgujOiRtEYmkOwEopr7bhyBStiEW/oNRh3LNC6H7QyNTRWPaEp9JmZQZD j9TgtjlK0+Sv+FF1hFtsF1mOZuP2RgUmQ8qLdKnVfirfMlNxd/jEs60qYNylYkpvA7/2 IjTj/4Qdx0zf2NNrMbRHA3hYLk4xNMVC1Vh2JP3cYgHczXJTM5GQSnnxicezzDgoIj4m x8iaOCKXs8lNZ0XvKWf2ciPQDMUqTTE0KRr/ws4S1cLhRz+LczBD/bkZpWdU0SvPyoX0 gvcDKcBDEkPKmk0c4e5OSWqinLJForh2cFsydBeqzYbtyvO68ThP7FFPCEf6tyluCBKh pPog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P7WBX1KN; 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 gn2si7180740plb.34.2019.05.22.03.23.20; Wed, 22 May 2019 03:23:35 -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=P7WBX1KN; 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 S1729035AbfEVKWB (ORCPT + 99 others); Wed, 22 May 2019 06:22:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728438AbfEVKWB (ORCPT ); Wed, 22 May 2019 06:22:01 -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 32F6220868; Wed, 22 May 2019 10:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558520520; bh=zvNJXlde6vJrju/6950RKpxcXEfG+fB++d7z7grzFag=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P7WBX1KNk5ZPcye971Igpz9KNRW0hUPTKC2es54jfcQp4y4wE3GVnKWGd2dZZAofo oG6/J1R9fSNMWYg0vdbULKxqQCL2qZDAk0CpbLjTuwEitPQJdzUsg4rH6NHH1DbSzg JAYpLv+ue/Y+y9aXygNq6xNKQ0ZHOs2G4yDEiQqI= Date: Wed, 22 May 2019 12:21:58 +0200 From: Greg Kroah-Hartman To: Pavel Machek Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Theodore Tso , stable@kernel.org Subject: Re: [PATCH 4.19 067/105] ext4: protect journal inodes blocks using block_validity Message-ID: <20190522102158.GA6721@kroah.com> References: <20190520115247.060821231@linuxfoundation.org> <20190520115251.802050920@linuxfoundation.org> <20190522091859.GD8174@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190522091859.GD8174@amd> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 22, 2019 at 11:18:59AM +0200, Pavel Machek wrote: > On Mon 2019-05-20 14:14:13, Greg Kroah-Hartman wrote: > > From: Theodore Ts'o > > > > commit 345c0dbf3a30872d9b204db96b5857cd00808cae upstream. > > > > Add the blocks which belong to the journal inode to block_validity's > > system zone so attempts to deallocate or overwrite the journal due a > > corrupted file system where the journal blocks are also claimed by > > another inode. > > > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202879 > > Signed-off-by: Theodore Ts'o > > Cc: stable@kernel.org > > Signed-off-by: Greg Kroah-Hartman > > > +static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) > > +{ > > + struct inode *inode; > > + struct ext4_sb_info *sbi = EXT4_SB(sb); > > + struct ext4_map_blocks map; > > + u32 i = 0, err = 0, num, n; > > + > > + if ((ino < EXT4_ROOT_INO) || > > + (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) > > + return -EINVAL; > > + inode = ext4_iget(sb, ino, EXT4_IGET_SPECIAL); > > + if (IS_ERR(inode)) > > + return PTR_ERR(inode); > > + num = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; > > + while (i < num) { > > + map.m_lblk = i; > > + map.m_len = num - i; > > + n = ext4_map_blocks(NULL, inode, &map, 0); > > + if (n < 0) { > > + err = n; > > + break; > > + } > > n is unsigned, so this can not happen. Commit 102/ actually fixes this > up. Should they be merged together? No, we keep things identical to how they are upstream, otherwise it is impossible to keep track of what happened here. This patch, and 2 others were dropped anyway, so you don't have to worry about it :) greg k-h