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 1BB7B3174D; Tue, 16 Jan 2024 00:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HFPnN0Os" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FAF5C433F1; Tue, 16 Jan 2024 00:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364721; bh=M2A3k/D8aKcmBljOIJdK6Rkk0TljffAlXnXBZRh3LvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFPnN0OsYaBaOCZ+LcRHSsY/Be3rJI9mZivvuaDuTSy2LZfpC5pKKhT0uNGbaXOBn t05JPwv1hFr1TUDOgsaBFcrLg5KMmBWl7SSQomu8nUlmq7v3S5T7hhx8Nq7zFqlkPC kWYItTYk/g/iVRuEGsucp92712Jvvxd7pz9scTmyV68uED5rbYN5sWlBE29YdRyPtI P56av5cgwe3ua4dbOUa14FClI7NKT7sMx2bxKPMfPxQgX5JO8GNyOZS1fxr7uA8o8e NRkbK9XGtLOj/RTCO8MAJ0J3cOZW8WhPzED+qlqA66KZ+aECbG/XuPTIcgBMFMPf/s PQwZ87oYEXB8Q== 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.1 03/14] jfs: fix slab-out-of-bounds Read in dtSearch Date: Mon, 15 Jan 2024 19:24:45 -0500 Message-ID: <20240116002512.215607-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116002512.215607-1-sashal@kernel.org> References: <20240116002512.215607-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 6.1.73 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