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 8A165F4E1; Tue, 16 Jan 2024 00:23:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nL9CZAQm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3559C433C7; Tue, 16 Jan 2024 00:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364600; bh=M2A3k/D8aKcmBljOIJdK6Rkk0TljffAlXnXBZRh3LvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nL9CZAQmEIT2pGIwkokq2pHYMWoK8rZHrB9D9FhMZnLxSDWf9m39O8cZFxDlfuC3X r1bzBlkrJ+nDaqr07fgd+3pxa55FyHLzF0VVHJPb/fVAK7yZY/sDX+mk0u3botlkJq k0FeW0sEo3jAxxbzXWrtiZVwtrF5RpzWuzp2rX0c2NQC9rc1LiBLp5PEksb5/Jp6RN AsTP6aaSZF77dkkTrSXBryBozVLZCYpBNcZr9uNeP1vYnF3Ny+N07b0ytF8yUtFGlK KtU2kw0ly6iufRJsj7NrqeBAagaQ/pXj761h8K1i3FR78BF8ZUbVXOKPKWTnEIhPQv DOAkCkoIzdVtQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Manas Ghandat , kernel test robot , Dan Carpenter , Dave Kleikamp , Sasha Levin , shaggy@kernel.org, osmtendev@gmail.com, jfs-discussion@lists.sourceforge.net Subject: [PATCH AUTOSEL 6.7 03/19] jfs: fix slab-out-of-bounds Read in dtSearch Date: Mon, 15 Jan 2024 19:22:39 -0500 Message-ID: <20240116002311.214705-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116002311.214705-1-sashal@kernel.org> References: <20240116002311.214705-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7 Content-Transfer-Encoding: 8bit From: Manas Ghandat [ Upstream commit fa5492ee89463a7590a1449358002ff7ef63529f ] Currently while searching for current page in the sorted entry table of the page there is a out of bound access. Added a bound check to fix the error. Dave: Set return code to -EIO Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202310241724.Ed02yUz9-lkp@intel.com/ Signed-off-by: Manas Ghandat Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_dtree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index f3d3e8b3f50c..031d8f570f58 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -633,6 +633,11 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) { index = base + (lim >> 1); + if (stbl[index] < 0) { + rc = -EIO; + goto out; + } + if (p->header.flag & BT_LEAF) { /* uppercase leaf name to compare */ cmp = -- 2.43.0