summaryrefslogtreecommitdiff
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2024-04-23 17:21:58 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2024-05-24 12:50:12 +0300
commit302e9dca8428979c9c99f2dbb44dc1783f5011c3 (patch)
tree1719b1852705651c5b0b7af3473d9d502827bccf /fs/ntfs3
parent05afeeebcac850a016ec4fb1f681ceda11963562 (diff)
downloadlinux-302e9dca8428979c9c99f2dbb44dc1783f5011c3.tar.xz
fs/ntfs3: Break dir enumeration if directory contents error
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
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/dir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index 5cf3d9decf64..45e556fd7c54 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;
}