mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
fs: disallow all fallocate operation on active swapfile
Currently some file system have IS_SWAPFILE check in their fallocate implementations and some do not. However we should really prevent any fallocate operation on swapfile so move the check to vfs and remove the redundant checks from the file systems fallocate implementations. Signed-off-by: Lukas Czerner <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
This commit is contained in:
parent
23fffa925e
commit
0790b31b69
4 changed files with 7 additions and 13 deletions
|
|
@ -262,6 +262,13 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
|
|||
if (IS_IMMUTABLE(inode))
|
||||
return -EPERM;
|
||||
|
||||
/*
|
||||
* We can not allow to do any fallocate operation on an active
|
||||
* swapfile
|
||||
*/
|
||||
if (IS_SWAPFILE(inode))
|
||||
ret = -ETXTBSY;
|
||||
|
||||
/*
|
||||
* Revalidate the write permissions, in case security policy has
|
||||
* changed since the files were opened.
|
||||
|
|
|
|||
Loading…
Reference in a new issue