]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fs/ntfs3: Break dir enumeration if directory contents error
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 23 Apr 2024 14:21:58 +0000 (17:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:13 +0000 (13:39 +0200)
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>
fs/ntfs3/dir.c

index 72cdfa8727d3c34a7a81515e1cbf84b80b7f4d34..98f57d0c702ebadc835cb493864813bc93bcff6c 100644 (file)
@@ -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;
                }