From 14d2a7ce717c09ec6331836ae8739274278c5f40 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 25 Feb 2019 16:40:37 +0800 Subject: [PATCH] ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT mainline inclusion from mainline-5.1 commit 6e589291f4b1b700ca12baec5930592a0d51e63c category: bugfix bugzilla: 10709 CVE: NA --------------------------- 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 Conflict: fs/ext4/ioctl.c Signed-off-by: zhangyi (F) Reviewed-by: yangerkun Signed-off-by: Yang Yingliang --- fs/ext4/ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index d37dafa1d133..e858813e07e6 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -118,6 +118,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)) return -EINVAL; -- GitLab