]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT
authorTheodore Ts'o <tytso@mit.edu>
Mon, 11 Feb 2019 06:07:10 +0000 (01:07 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 11 Feb 2019 06:07:10 +0000 (01:07 -0500)
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>
fs/ext4/ioctl.c

index 2e76fb55d94ac90fae96fc0b2e3639f88e8fb68a..eb8ca8d80885ad917d9892a26c467dbae6a436e9 100644 (file)
@@ -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;