OSDN Git Service

ext4: fix EXT4_IOC_SWAP_BOOT
authorTheodore Ts'o <tytso@mit.edu>
Tue, 2 Oct 2018 22:21:19 +0000 (18:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:43 +0000 (11:08 -0800)
commitb2af09dd37433a10c5f626339ae406f135f8bfb2
tree38b1d1a83276bad2a2046e72c9df94a9ef322051
parent8c448126af0e8fb16ef43303aa30890baa6f4e78
ext4: fix EXT4_IOC_SWAP_BOOT

commit 18aded17492088962ef43f00825179598b3e8c58 upstream.

The code EXT4_IOC_SWAP_BOOT ioctl hasn't been updated in a while, and
it's a bit broken with respect to more modern ext4 kernels, especially
metadata checksums.

Other problems fixed with this commit:

* Don't allow installing a DAX, swap file, or an encrypted file as a
  boot loader.

* Respect the immutable and append-only flags.

* Wait until any DIO operations are finished *before* calling
  truncate_inode_pages().

* Don't swap inode->i_flags, since these flags have nothing to do with
  the inode blocks --- and it will give the IMA/audit code heartburn
  when the inode is evicted.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Reported-by: syzbot+e81ccd4744c6c4f71354@syzkaller.appspotmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ioctl.c