diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-02-11 01:07:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-06 13:05:37 +0100 |
commit | f251c83d6c08bc555809e275b47abbf35c532a30 (patch) | |
tree | a00b231d6fd59fb141f61d45c14aa9d8a5a71a00 | |
parent | cc4d8283f6e9c5084fe61321a37c2fcf4256b0fd (diff) | |
download | linux-stable-f251c83d6c08bc555809e275b47abbf35c532a30.tar.gz linux-stable-f251c83d6c08bc555809e275b47abbf35c532a30.tar.bz2 linux-stable-f251c83d6c08bc555809e275b47abbf35c532a30.zip |
ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT
[ Upstream commit 6e589291f4b1b700ca12baec5930592a0d51e63c ]
A malicious/clueless root user can use EXT4_IOC_SWAP_BOOT to force a
corner casew which can lead to the file system getting corrupted.
There's no usefulness to allowing this, so just prohibit this case.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/ext4/ioctl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index abb6fcff0a1d..783c54bb2ce7 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -132,6 +132,7 @@ static long swap_inode_boot_loader(struct super_block *sb, if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) || IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) || + (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) || ext4_has_inline_data(inode)) { err = -EINVAL; goto journal_err_out; |