From: Konstantin Komarov almaz.alexandrovich@paragon-software.com
stable inclusion from stable-v6.6.33 commit 579a0c69794b60dcbea4cfbd26a39222fcba0054 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAD6H2
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
commit 302e9dca8428979c9c99f2dbb44dc1783f5011c3 upstream.
If we somehow attempt to read beyond the directory size, an error is supposed to be returned.
However, in some cases, read requests do not stop and instead enter into a loop.
To avoid this, we set the position in the directory to the end.
Signed-off-by: Konstantin Komarov almaz.alexandrovich@paragon-software.com Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org Signed-off-by: Wang Hai wanghai38@huawei.com --- fs/ntfs3/dir.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index 2c73ca469d51..ac8eb8657f1a 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -475,6 +475,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *ctx) vbo = (u64)bit << index_bits; if (vbo >= i_size) { ntfs_inode_err(dir, "Looks like your dir is corrupt"); + ctx->pos = eod; err = -EINVAL; goto out; }