diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-19 02:35:20 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-19 02:35:20 +0200 |
commit | e6bc9de714972cac34daa1dc1567ee48a47a9342 (patch) | |
tree | bb688c082764b6ce11d1160f525f535836d3f591 /fs/block_dev.c | |
parent | Merge tag 'ovl-fixes-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ms... (diff) | |
parent | vfs: don't allow writes to swap files (diff) | |
download | linux-e6bc9de714972cac34daa1dc1567ee48a47a9342.tar.xz linux-e6bc9de714972cac34daa1dc1567ee48a47a9342.zip |
Merge tag 'vfs-5.4-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull swap access updates from Darrick Wong:
"Prohibit writing to active swap files and swap partitions.
There's no non-malicious use case for allowing userspace to scribble
on storage that the kernel thinks it owns"
* tag 'vfs-5.4-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
vfs: don't allow writes to swap files
mm: set S_SWAPFILE on blockdev swap devices
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 677cb364d33f..9c073dbdc1b0 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1972,6 +1972,9 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) if (bdev_read_only(I_BDEV(bd_inode))) return -EPERM; + if (IS_SWAPFILE(bd_inode)) + return -ETXTBSY; + if (!iov_iter_count(from)) return 0; |