From: liubaolin <liubaolin12138@163.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>,
Namjae Jeon <linkinjeon@kernel.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
Zhan Xusheng <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH 2/2] ntfs: reject direct I/O reads of encrypted files
Date: Mon, 12 Oct 2026 16:49:22 +0800 [thread overview]
Message-ID: <3e92aa95-c831-4449-b229-5a43d2ace3e3@163.com> (raw)
In-Reply-To: <20261012062040.3826828-3-zhanxusheng@xiaomi.com>
在 2026/10/12 14:20, Zhan Xusheng 写道:
> From: Zhan Xusheng <zhanxusheng@xiaomi.com>
>
> 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.
>
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> Fixes: 9c87959601e8 ("ntfs: update file operations")
> ---
> 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 007d1614b9ac6..eb8ed1959cd4c 100644
> --- a/fs/ntfs/file.c
> +++ b/fs/ntfs/file.c
> @@ -460,8 +460,8 @@ static 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);
Looks good to me.
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
next prev parent reply other threads:[~2026-10-12 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 6:20 [PATCH 0/2] ntfs: enforce the encrypted-file policy on the read paths Zhan Xusheng
2026-10-12 6:20 ` [PATCH 1/2] ntfs: do not read ahead encrypted files Zhan Xusheng
2026-10-12 8:49 ` liubaolin
2026-10-12 6:20 ` [PATCH 2/2] ntfs: reject direct I/O reads of " Zhan Xusheng
2026-10-12 8:49 ` liubaolin [this message]
2026-10-12 8:50 ` [PATCH 0/2] ntfs: enforce the encrypted-file policy on the read paths liubaolin
2026-10-12 10:01 ` Hyunchul Lee
2026-10-12 11:58 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e92aa95-c831-4449-b229-5a43d2ace3e3@163.com \
--to=liubaolin12138@163.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®