mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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: 9c87959601 ("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>
This commit is contained in:
parent
5db65a43ed
commit
b08619bf3c
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user