Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0414F4BEE32; Sat, 12 Sep 2026 11:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789211790; cv=none; b=hKj9ravNKRZZeSFeoTEYAt37g0/Lr5qIsxM36UHTaAt7PjeWJS6D0ZADugl1Ur9rrsuT6VLnFyyrzkQE2HALR2T3QkKx8EoJU7kI6WEvBohxrVkUv0YFOczXXKi1kH5Xathv0fITRLLl9bFbQXU0n7q0RUH3yHRTy6eS/XlVg7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789211790; c=relaxed/simple; bh=UpwH2ob8aIEZ/D0RQehyPSL1SFECtdUO8dzJkqH0bYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MBnnVW+1ROA95C5c/zF94E0zYzfjiocGdr3xUNK3Xbl+BPzivGdxaQDkm7y7dY1Ycw/swOQE9ZgD/9Uf9zCBJsTQgpUIxuzaKJt/Ry4aDNdD7Q0ZAc9qWZJLHZLxjrIlFDvjj5vpkJ/XuVTbYOTPb1sS57KwaRp37egM+MyXx8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=13qUr1AQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="13qUr1AQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA1F81F000FF; Sat, 12 Sep 2026 11:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789211788; bh=wP/RpsXvNY4X2UAHrwHh31nF3SSiaCSubEd5478APTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=13qUr1AQ+h7rDLPUgH22IQSqrnNN8NNIXSHDMxdvBBSdyG16kQ5AMz/tXRXHn80Li LRx3o00zaiOHWdn1x0ngw5R/ou6oDt1YSVApkviyvmVrPjIFDbnXt/UTIPjrr2bn6Z olBdNcbRGQ0I7/6cc33QAq6q40O87TOjTJmHzieA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangshuo Li , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.18 1286/1518] platform/x86: hp-bioscfg: fix password encoding bounds check Date: Sat, 12 Sep 2026 08:57:35 +0200 Message-ID: <20260912065652.605815770@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@linuxfoundation.org> User-Agent: quilt/0.69 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guangshuo Li [ Upstream commit e213939ed9e6e6badf7aa48c4c8dd9a9cdf00615 ] The password PSWD_ENCODINGS parser reads password_obj[elem + pos_values] while copying the supported password encodings from the ACPI package. The outer loop only guarantees that elem is within password_obj_count. The encoding count is bounded by MAX_ENCODINGS_SIZE, but that does not guarantee that the ACPI package contains enough entries for all elem + pos_values accesses. A malformed package can therefore declare a non-zero encoding count without providing enough string objects, causing the parser to read past the ACPI package array and pass an out-of-bounds string pointer and length to hp_convert_hexstr_to_str(). Add the same computed-index bounds check used by the other offset-based package parsing loops before reading password_obj[elem + pos_values]. Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes") Signed-off-by: Guangshuo Li Link: https://patch.msgid.link/20260708090937.740435-1-lgs201920130244@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c index 3c7fbb1a87e2c..6b94f90bea07a 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -353,6 +353,11 @@ static int hp_populate_password_elements_from_package(union acpi_object *passwor case PSWD_ENCODINGS: size = min_t(u32, password_data->encodings_size, MAX_ENCODINGS_SIZE); for (pos_values = 0; pos_values < size; pos_values++) { + if (elem + pos_values >= password_obj_count) { + pr_err("Error elem-objects package is too small\n"); + return -EINVAL; + } + ret = hp_convert_hexstr_to_str(password_obj[elem + pos_values].string.pointer, password_obj[elem + pos_values].string.length, &str_value, &value_len); -- 2.53.0