From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 886EF26F45E; Tue, 8 Apr 2025 12:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116556; cv=none; b=XW5f/uF67L1w2VARmNFZyTL7DEtle4LU2FzaAsBElLJdm2NH10h7JN84V8GCrrpF6eSrT4F+whkttw+MPqpvMbu9q8S+ToUtMJCWtMl6mn8+ZG/7DKqS4iAW+7x8Oe23ZaiE9Zx//axRM+lUopt8CQABcf1DDRw1mv6bxIBBVGA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116556; c=relaxed/simple; bh=VTU0VD/AmbxONnNqikklL6+1CYIfkbIvfnXHtL/htTc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fQFuGMZveewZXXq622a3JDGve5OeycCFmxoFXjyHDMwDLu6qNiGgV5YceMCD6hnQJNC9elzrs6ukomF5aEmpKjbVeh/dgIFR8GRp+2OguLDj1+ok8IRfhcs828UXI1eHEghM4CjV4FopCOUWUau5DG/Q9sPAAI9OQpIy9fb32Sw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l8zBoLG5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l8zBoLG5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16075C4CEE5; Tue, 8 Apr 2025 12:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744116556; bh=VTU0VD/AmbxONnNqikklL6+1CYIfkbIvfnXHtL/htTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8zBoLG5GQFWjpgp5OafULjrQMPgEmaCE9u9BWjgJ1hHVhXYciZwV3lQp0WgNlvf/ ZW9pc3EQsocf8YxdYtkfG8fDrg1oWUKDOQw2TOXjnRuzuwzU1E0GAQ0bNj9dKLAb26 Q93pqTo6u9A3NaKyJEPkDeFhxZqRwyz5btiIqyK8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Konstantin Komarov , Sasha Levin Subject: [PATCH 6.12 184/423] fs/ntfs3: Fix a couple integer overflows on 32bit systems Date: Tue, 8 Apr 2025 12:48:30 +0200 Message-ID: <20250408104850.028423040@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104845.675475678@linuxfoundation.org> References: <20250408104845.675475678@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 5ad414f4df2294b28836b5b7b69787659d6aa708 ] On 32bit systems the "off + sizeof(struct NTFS_DE)" addition can have an integer wrapping issue. Fix it by using size_add(). Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Dan Carpenter Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 7eb9fae22f8da..78d20e4baa2c9 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -618,7 +618,7 @@ static bool index_hdr_check(const struct INDEX_HDR *hdr, u32 bytes) u32 off = le32_to_cpu(hdr->de_off); if (!IS_ALIGNED(off, 8) || tot > bytes || end > tot || - off + sizeof(struct NTFS_DE) > end) { + size_add(off, sizeof(struct NTFS_DE)) > end) { /* incorrect index buffer. */ return false; } @@ -736,7 +736,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, if (end > total) return NULL; - if (off + sizeof(struct NTFS_DE) > end) + if (size_add(off, sizeof(struct NTFS_DE)) > end) return NULL; e = Add2Ptr(hdr, off); -- 2.39.5