Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp242828ybm; Wed, 22 May 2019 02:20:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSGrwnuchnv48icNl8QFdvtgCS2rOOuCTynbhxAz6kK7e7434D9GD96GJ3kmzrvny5xi+f X-Received: by 2002:a17:902:42a5:: with SMTP id h34mr66709071pld.178.1558516843565; Wed, 22 May 2019 02:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558516843; cv=none; d=google.com; s=arc-20160816; b=e2lh9WfMoX6lb69oZlL8ruCE0Kf8A9kPT8mkadMRfu9ZW7iiNP+zkBFCxqU4wFAq71 Mv4jKmeyxQvebJQPsMg9q0J3/72LcnaGBKQ9gBOUhAj5ntQ8ltXZ5PsKvwAYSwDOcGpt lka/RVjpXCcxG4vB+sxmS/stQXumJ/C/Tt56ULS4ipOamTWtBfwEeA9+q0U8Rmu5WSDj Y2/TxFW9pMUO6dFCgQeCAioybxTUif/6dBrQCd4VMaIFYx75sdipwbVTzguQJgVcBKCE sFTTopY4ZTcoFmHNe9OZTE5CRcPO2Bk9+BPDoc3OrNIHESBOmAIQZQHe4fUvNm6x15ey T0kg== 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; bh=eK7Yv7Hvgy3pAvMLnuv0qgrZWOOFbSbDjWPPQXhZn7c=; b=V4dQF4SR8hvrJio4t5ICSZrvr18jtcOWAmSjRut0xpU6KZXsckdyuBonYHFjrobmaI A47pQneul797xZyZceO2Ra+AoJxs/bBojhv4+ztLgeZ3wK2knMis37qZnmRyAcvHZRh6 2snhHOluvnMaphtCTs/YXCha53Jl6WwK9fjgVP/k9FmTnLweK843vKXSL8V8j9xXFh8b FPz/zHIkwzAsP+NQpZznKUni/ly7a1E+L7enwk4ryUJnrIaYmxdrhiQw37HcrnwxFyHs xLuJdgGmQ4xvT7/bBKDY8RtOD/Td6GGNsiNre4bacNJMgc5YiWpzeZmLEf+xB82Dj+Ts a1MQ== ARC-Authentication-Results: i=1; mx.google.com; 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 b129si27216194pfa.254.2019.05.22.02.20.27; Wed, 22 May 2019 02:20:43 -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; 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 S1728774AbfEVJTD (ORCPT + 99 others); Wed, 22 May 2019 05:19:03 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:42697 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbfEVJTD (ORCPT ); Wed, 22 May 2019 05:19:03 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 86BFA80378; Wed, 22 May 2019 11:18:50 +0200 (CEST) Date: Wed, 22 May 2019 11:18:59 +0200 From: Pavel Machek To: Greg Kroah-Hartman 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: <20190522091859.GD8174@amd> References: <20190520115247.060821231@linuxfoundation.org> <20190520115251.802050920@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="n/aVsWSeQ4JHkrmm" Content-Disposition: inline In-Reply-To: <20190520115251.802050920@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --n/aVsWSeQ4JHkrmm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon 2019-05-20 14:14:13, Greg Kroah-Hartman wrote: > From: Theodore Ts'o >=20 > commit 345c0dbf3a30872d9b204db96b5857cd00808cae upstream. >=20 > 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. >=20 > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D202879 > 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 =3D EXT4_SB(sb); > + struct ext4_map_blocks map; > + u32 i =3D 0, err =3D 0, num, n; > + > + if ((ino < EXT4_ROOT_INO) || > + (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) > + return -EINVAL; > + inode =3D ext4_iget(sb, ino, EXT4_IGET_SPECIAL); > + if (IS_ERR(inode)) > + return PTR_ERR(inode); > + num =3D (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; > + while (i < num) { > + map.m_lblk =3D i; > + map.m_len =3D num - i; > + n =3D ext4_map_blocks(NULL, inode, &map, 0); > + if (n < 0) { > + err =3D n; > + break; > + } n is unsigned, so this can not happen. Commit 102/ actually fixes this up. Should they be merged together? Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --n/aVsWSeQ4JHkrmm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlzlFAMACgkQMOfwapXb+vJq4wCgn36T6gqyb9hYAkUACt/sWf6X Vx4AoLpp/mcCGyVZaXMnQ/iuqO+XYHEf =vNgS -----END PGP SIGNATURE----- --n/aVsWSeQ4JHkrmm--