aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-12-26 10:10:22 -0600
committerTheodore Ts'o <tytso@mit.edu>2020-01-17 16:24:53 -0500
commit33b4cc2501d323feef3cc3ec9a084d80bef5b5e8 (patch)
treeae2b857d07fcdf275a124bb9d6eeb546a8d3ff0c /fs/ext4
parentext4: allow ZERO_RANGE on encrypted files (diff)
downloadlinux-dev-33b4cc2501d323feef3cc3ec9a084d80bef5b5e8.tar.xz
linux-dev-33b4cc2501d323feef3cc3ec9a084d80bef5b5e8.zip
ext4: only use fscrypt_zeroout_range() on regular files
fscrypt_zeroout_range() is only for encrypted regular files, not for encrypted directories or symlinks. Fortunately, currently it seems it's never called on non-regular files. But to be safe ext4 should explicitly check S_ISREG() before calling it. Signed-off-by: Eric Biggers <ebiggers@google.com> Link: https://lore.kernel.org/r/20191226161022.53490-1-ebiggers@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d3e1539c680b..73482fc86561 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -403,7 +403,7 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
{
int ret;
- if (IS_ENCRYPTED(inode))
+ if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
return fscrypt_zeroout_range(inode, lblk, pblk, len);
ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS);