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
This commit is contained in:
Konstantin Komarov 2024-04-23 17:21:58 +03:00
parent 05afeeebca
commit 302e9dca84
No known key found for this signature in database
GPG Key ID: A9B0331F832407B6

View File

@ -475,6 +475,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *ctx)
vbo = (u64)bit << index_bits; vbo = (u64)bit << index_bits;
if (vbo >= i_size) { if (vbo >= i_size) {
ntfs_inode_err(dir, "Looks like your dir is corrupt"); ntfs_inode_err(dir, "Looks like your dir is corrupt");
ctx->pos = eod;
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }