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? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html