Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp244970lqo; Thu, 16 May 2024 05:21:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6hjTGd25F4qX6iCLOGxR/ayYuqR+bYzo2Yu8AJiH8t3zb+XpMWMsHp8eAQryQXABRz7L95xS5EASMaCpgmjVgIxeOoox4vCb0vgcbnA== X-Google-Smtp-Source: AGHT+IGzLSsrTWyq2CXBf3qtHxlaz4LZwrdRx1qy7QsYojhi9uSuffydEng4r2PrkTklW/GNRA2K X-Received: by 2002:a05:6102:3ecc:b0:47c:49d:4c08 with SMTP id ada2fe7eead31-48077de5a20mr18780646137.12.1715862067689; Thu, 16 May 2024 05:21:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715862067; cv=pass; d=google.com; s=arc-20160816; b=vU5/O2lb7NNEpNk5/cLmC4lBlx/sqoQkPGxZxG8/2rkXRF8ZBdJgn5RzMgXVS4lCoh 7sh0Cv0RitVMJmzNJi2G5IlsIVoqrp/36Cv/6NkWH3tkkS9fO+O/jQ1mhJOe/4TZDfLs WB00EIyJPAy1cUa45+wboweD0aMuYwQQ7VvHBtA+DfdVOeM5G15VsbkzZK6fyGwdyhUt uEwnsllqyfl8Qf6DTlCjFw7dtM5XTjpeV+NRS2zxjSPObuzTcZ+VkjWbk+RLVIvdNyDB luBsICGCAQ+TwIoYKDfvKj8hLXigdyYrkQiOHqkskNCLfbB9kO5hJdSE+N7CuG0kGdOp 6KgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=138ZE/h5TNiCrz7tQ1X/Ht+h28eqyF8ISqvZy/ijiIs=; fh=WbG3pQqgOFrOjaCQjXklD+sM2SbjIExJnW8sLHLu1DM=; b=f2V9oKvXkGkc3Tm/8t6EMoCgcJ+MRD5LZ+tP0TzvvrJIlcshwlxF3Xn74Ju91ZdGLp Si60Gh+ypMsGg+wUlY1w7KdE6qj7t9NdHl6lMhUdgmp6OKmEBkzi0Eu2d6kgtwdCnazb dcnlcdytAvaiGnX6t2rZWMZQCc3ne6FG4V+C25q2svF1+r6CgPUziD39ZQjsTR3MLOrh hyeFXRFcOmO7emIZm2xJVw5ChtyF9KevVDOtZEWNlSWbA6/TjDjfWMY74GeG7LQUVNEn d7qbL8tQlbYf+Xv8We9KeWQgY8YStODkH67FEetOz9c9wPgMb7m0cI4Vl2hmZifqONu+ NVrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=AO3xszRr; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-180991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-481fa99c1eesi519513137.89.2024.05.16.05.21.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 05:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=AO3xszRr; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-180991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 413101C21488 for ; Thu, 16 May 2024 12:21:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74835145FF5; Thu, 16 May 2024 12:20:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="AO3xszRr" Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42E0F26AD0; Thu, 16 May 2024 12:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715862058; cv=none; b=uHQvI+U67U1H8gIA/2z3OB1hBc2DZ0sQfRCmIXSjTWrhozC7E6DKajglVw2htcRlPsL6BNXOHQSAe2xQOKHTr4cfNbf4Yu37K700vemOIaXStp9mouWaHNMAX1ZKTvyY/FkXRRven2wcd3hP+vhrq7yvF3gG5VKO7byZpGt9NxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715862058; c=relaxed/simple; bh=F9eh9r9r/qZd5F49xlN6/fKmFGQdqoJZjiCsTZHQf9A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QPQAZS+J1OV/4leNlmXpsO6oQ+R82rQv6fiLTmiPgBxjmaYI+RDEJz+q8y6CsXm+uX3/Y6t5tVDmAMieorAGcxxrn4rLkX9wobjXfz3L4zEVVr6DXfjMpsWAs6A9n7k+42bwW9tEfihPNi0W4V6vYP0Sw9o3WgYLm5iSd/oxHWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=AO3xszRr; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id CD4571F86; Thu, 16 May 2024 12:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1715861591; bh=138ZE/h5TNiCrz7tQ1X/Ht+h28eqyF8ISqvZy/ijiIs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AO3xszRrpn//tE5QGQZfFt7paqIrVePppoqB/v1/Gr88dJxUB2Uq0VurNp+bgqC5s 9XIrJFaIdNLPuB3dAzagT35Gzq80l9M/SGozoj5pxWzi+ChCFTDYZEkPSFxbce8hy4 o6s3X2ftvhxYQa/1bYZVTdb+1sl3lOwtt3HvbELA= Received: from ntfs3vm.paragon-software.com (192.168.211.154) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 16 May 2024 15:20:54 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov , Subject: [PATCH v2] fs/ntfs3: Break dir enumeration if directory contents error Date: Thu, 16 May 2024 15:20:41 +0300 Message-ID: <20240516122041.5759-1-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423144155.10219-2-almaz.alexandrovich@paragon-software.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) 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 Cc: stable@vger.kernel.org --- fs/ntfs3/dir.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.34.1