[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190522102158.GA6721@kroah.com>
Date: Wed, 22 May 2019 12:21:58 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Pavel Machek <pavel@...x.de>
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 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 <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?
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
Powered by blists - more mailing lists