diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-18 17:35:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-18 17:35:20 -0700 |
commit | e6bc9de714972cac34daa1dc1567ee48a47a9342 (patch) | |
tree | bb688c082764b6ce11d1160f525f535836d3f591 /mm/filemap.c | |
parent | b6c0d35772468173b5d3a7f6162079611e68a1e8 (diff) | |
parent | dc617f29dbe5ef0c8ced65ce62c464af1daaab3d (diff) |
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 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index d0cf700bf201..40667c2f3383 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2988,6 +2988,9 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from) loff_t count; int ret; + if (IS_SWAPFILE(inode)) + return -ETXTBSY; + if (!iov_iter_count(from)) return 0; |