From b08619bf3c213cd5605d72b363dd3000663c35c1 Mon Sep 17 00:00:00 2001 From: Zhan Xusheng Date: Mon, 12 Oct 2026 14:20:40 +0800 Subject: [PATCH] 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 Reviewed-by: Baolin Liu Reviewed-by: Hyunchul Lee Signed-off-by: Namjae Jeon --- fs/ntfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 46ea46ba2091..dafaeee6092b 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);