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 199255A0F7; Tue, 16 Jan 2024 00:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tk4FDrxQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE27FC43394; Tue, 16 Jan 2024 00:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364864; bh=kdhhXEJc9HdVp/h1emxwajwaH4zcDSobKJF9ZQkHgTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tk4FDrxQeeE5fNm9UVb7PTvnO7ZVpedBBCtDRuE86ynM1mSFA2wrtuhnMDmUwW55M uJuLZl3tG8y7tWYdK60QnGk9mjFCMsf+uh3QODTwa44qAsYryh/p/dJYjfp8E/Jcfr fzi9WMXrcunp1TMI4nFCKLySHSRTtcMOP5e68sIPOHXtR5eChvlgwlfXek6/rRgBHF 1PlobVJskfvSyaeKyNTsxZ7wpU8xde/CSte2PoOlmun/+OIgxGg8wAp3lvK8aFkR3Y UZl28kTClqZsgrxoOJlggEWWhK/50sB1Rl0m51Xtx3BHJT6sd2DdP/l2rnsn6YxaKl Vjwzk3gv4AGpQ== 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 5.4 03/12] jfs: fix slab-out-of-bounds Read in dtSearch Date: Mon, 15 Jan 2024 19:27:09 -0500 Message-ID: <20240116002731.216549-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116002731.216549-1-sashal@kernel.org> References: <20240116002731.216549-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.267 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 a6d42e49d156..077a87e53020 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