[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190522091859.GD8174@amd>
Date: Wed, 22 May 2019 11:18:59 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Theodore Tso <tytso@....edu>, stable@...nel.org
Subject: Re: [PATCH 4.19 067/105] ext4: protect journal inodes blocks using
block_validity
On Mon 2019-05-20 14:14:13, Greg Kroah-Hartman wrote:
> From: Theodore Ts'o <tytso@....edu>
>
> 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 <tytso@....edu>
> Cc: stable@...nel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> +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?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists