summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhan Xusheng <zhanxusheng@xiaomi.com>2026-10-12 14:20:40 +0800
committerNamjae Jeon <linkinjeon@kernel.org>2026-10-20 17:28:03 +0900
commit53cb23e5ea54f4ec6e3caf29ab98ea99b00bb02f (patch)
tree5354fdb2a5e34057694ca51f22f4f67f32a2cc2d
parentc505a2fabcdc1b0577dfdc13de3fbd61dda7873f (diff)
downloadlinux-next-53cb23e5ea54f4ec6e3caf29ab98ea99b00bb02f.tar.gz
linux-next-53cb23e5ea54f4ec6e3caf29ab98ea99b00bb02f.zip
ntfs: reject direct I/O reads of encrypted files
ntfs_file_read_iter() refuses direct I/O for compressed and WOF compressed attributes but lets encrypted ones reach iomap_dio_rw(). ntfs_read_iomap_begin_non_resident() has no NInoEncrypted() test, so it reports IOMAP_MAPPED for the attribute's real clusters and the raw on-disk ciphertext is copied to the caller. Buffered reads are refused by ntfs_read_folio(), but direct I/O never calls it. Fixes: 9c87959601e8 ("ntfs: update file operations") Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com> Reviewed-by: Baolin Liu <liubaolin@kylinos.cn> Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-rw-r--r--fs/ntfs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 9c7678922177..58afd310d57b 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -706,8 +706,8 @@ ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (NVolShutdown(NTFS_SB(sb)))
return -EIO;
- if ((NInoCompressed(NTFS_I(vi)) || NInoWofCompressed(NTFS_I(vi))) &&
- iocb->ki_flags & IOCB_DIRECT)
+ if ((NInoCompressed(NTFS_I(vi)) || NInoWofCompressed(NTFS_I(vi)) ||
+ NInoEncrypted(NTFS_I(vi))) && iocb->ki_flags & IOCB_DIRECT)
return -EOPNOTSUPP;
inode_lock_shared(vi);