diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-10-05 22:56:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-14 08:47:57 -0800 |
commit | 65f2579916b6224c06514382d2bfc5841d43f291 (patch) | |
tree | 83ae34b6ca2b75e9775b7544296d1404e2fbec25 /fs/ext4/inode.c | |
parent | 744539f1d7e5349ff8084432ccb67f02e015fcf7 (diff) | |
download | linux-3.10-65f2579916b6224c06514382d2bfc5841d43f291.tar.gz linux-3.10-65f2579916b6224c06514382d2bfc5841d43f291.tar.bz2 linux-3.10-65f2579916b6224c06514382d2bfc5841d43f291.zip |
ext4: add ext4_iget_normal() which is to be used for dir tree lookups
commit f4bb2981024fc91b23b4d09a8817c415396dbabb upstream.
If there is a corrupted file system which has directory entries that
point at reserved, metadata inodes, prohibit them from being used by
treating them the same way we treat Boot Loader inodes --- that is,
mark them to be bad inodes. This prohibits them from being opened,
deleted, or modified via chmod, chown, utimes, etc.
In particular, this prevents a corrupted file system which has a
directory entry which points at the journal inode from being deleted
and its blocks released, after which point Much Hilarity Ensues.
Reported-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f9e11df768d..c04f7adc7b5 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4351,6 +4351,13 @@ bad_inode: return ERR_PTR(ret); } +struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino) +{ + if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) + return ERR_PTR(-EIO); + return ext4_iget(sb, ino); +} + static int ext4_inode_blocks_set(handle_t *handle, struct ext4_inode *raw_inode, struct ext4_inode_info *ei) |