diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-02-11 01:07:10 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-02-11 01:07:10 -0500 |
commit | 6e589291f4b1b700ca12baec5930592a0d51e63c (patch) | |
tree | d6c8cb6b4bcf16c569c3e048296411eab08d0b5d /fs/ext4/ioctl.c | |
parent | abdc644e8cbac2e9b19763680e5a7cf9bab2bee7 (diff) |
ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT
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>
Diffstat (limited to 'fs/ext4/ioctl.c')
-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 2e76fb55d94a..eb8ca8d80885 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, | |||
132 | 132 | ||
133 | if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) || | 133 | if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) || |
134 | IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) || | 134 | IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) || |
135 | (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) || | ||
135 | ext4_has_inline_data(inode)) { | 136 | ext4_has_inline_data(inode)) { |
136 | err = -EINVAL; | 137 | err = -EINVAL; |
137 | goto journal_err_out; | 138 | goto journal_err_out; |