lkml.org 
[lkml]   [2019]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@mit.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@mit.edu>
> Cc: stable@kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-05-22 11:19    [W:0.436 / U:1.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site