ext4: only use fscrypt_zeroout_range() on regular files
Eric Biggers
maintainerPATCH 1/1 ext4: only use fscrypt_zeroout_range() on regular files
From: Eric Biggers <[email protected]>
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 <[email protected]>
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -402,7 +402,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 );
Signature · 1 line
2.24.1
Quoted 9 lines · Eric Biggers
From: Eric Biggers <[email protected]>
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 <[email protected]>
Thanks, applied.
- Ted