diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-09-03 01:43:17 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-09-03 01:43:17 -0400 |
commit | 6456ca6520ab6c9aec589b4640169cd6da378c68 (patch) | |
tree | fd571eddedc34f63bc84e72e6c6c190ec0056be0 /fs/ext4/inode.c | |
parent | 9ba55543fc0c6bb1cf8edd63be8802d9ab7e1202 (diff) | |
download | linux-6456ca6520ab6c9aec589b4640169cd6da378c68.tar.bz2 |
ext4: fix kernel oops caused by spurious casefold flag
If an directory has the a casefold flag set without the casefold
feature set, s_encoding will not be initialized, and this will cause
the kernel to dereference a NULL pointer. In addition to adding
checks to avoid these kernel oops, attempts to load inodes with the
casefold flag when the casefold feature is not enable will cause the
file system to be declared corrupted.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e567f0229d4e..4e271b509af1 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5067,6 +5067,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, "iget: bogus i_mode (%o)", inode->i_mode); goto bad_inode; } + if (IS_CASEFOLDED(inode) && !ext4_has_feature_casefold(inode->i_sb)) + ext4_error_inode(inode, function, line, 0, + "casefold flag without casefold feature"); brelse(iloc.bh); unlock_new_inode(inode); |