Commit 6e589291 authored by Theodore Ts'o's avatar Theodore Ts'o

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: default avatarTheodore Ts'o <tytso@mit.edu>
parent abdc644e
...@@ -132,6 +132,7 @@ static long swap_inode_boot_loader(struct super_block *sb, ...@@ -132,6 +132,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) || if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) ||
IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) || IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) ||
(EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) ||
ext4_has_inline_data(inode)) { ext4_has_inline_data(inode)) {
err = -EINVAL; err = -EINVAL;
goto journal_err_out; goto journal_err_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment