summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-04-09 23:37:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-02 17:24:45 +0200
commit795762468125a6412c089651e74f780bee154118 (patch)
tree7b356bf6204b267439f04b1777d11f140173bd68 /fs/ext4/inode.c
parentadd40f8f1a84d7c8feb76e8ab7f197a5b0627bd8 (diff)
downloadlinux-stable-795762468125a6412c089651e74f780bee154118.tar.gz
linux-stable-795762468125a6412c089651e74f780bee154118.tar.bz2
linux-stable-795762468125a6412c089651e74f780bee154118.zip
ext4: protect journal inode's blocks using block_validity
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: Ashwin H <ashwinh@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index af1404d337dc..1bc0037c50aa 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -407,6 +407,10 @@ static int __check_block_validity(struct inode *inode, const char *func,
unsigned int line,
struct ext4_map_blocks *map)
{
+ if (ext4_has_feature_journal(inode->i_sb) &&
+ (inode->i_ino ==
+ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum)))
+ return 0;
if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk,
map->m_len)) {
ext4_error_inode(inode, func, line, map->m_pblk,