From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86D6E40DFBD for ; Mon, 3 Aug 2026 14:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785767470; cv=none; b=BltGkJoih2DVyZvbU/6IxfUj8z9cZF1zDiNBunIRVTs1oS4mMUjs2jrPieiMuumdS85n9OliyV5mEtzi9E8AdYGG9V6IKpJhBqOTtXH/vGv39MFg5aUMu/kDCWecF4VXrf/xRUmVcNvMyPZld7BTMBIBNKSHumnIGEveqHBJp3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785767470; c=relaxed/simple; bh=rhV+qOT/cedymAeQ3DQaL+LQcUHG8piPrtIkVunzAvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V19TagNBNBorUcv2AZuWHuVR+Wr8brjyu2e92pN1WtfTXq1nvZMEMJBmUWpGWewiwPj9Rnt6ROTi6x+Bx0qTQsR09yCliA9Y3EDRjiGSi5wayQigCycdhZAuKjYYyfmikp5R6tK4cY0n2lKhObmQ6hzOcVXyMZda1uI6MRC/8pA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ocRj+FK3; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ocRj+FK3" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4980dc26022so13784345e9.1 for ; Mon, 03 Aug 2026 07:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785767466; x=1786372266; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hNoDrCXm49lLgm2lL6InxDz3MAxyPtaZVFbbdYtrWx4=; b=ocRj+FK3AEnX5Nld63RlI6N4AAoJhPXAfs9T8hZzjcSB4Pg+8YvHdN3TlCqC81jakX t3K6esULZ6+xtHsvrj8pVijO08HSBDe4bypRRFAFw3zH9BP2uVR7suvdkbpEHEujmt+n fwYGlNrpwG0UMHd6rUSAW1VnIWXYHVO4/GM8S+xGtQKvDJ56VPTRB1jyQuDZFZoJf3DO 5AoOoFZAndWSDH5bpGeAkGKeF2jYHUGRYOXcWISc3eD9I58uTTiKXBa28cfENLd1HWkU OJ4nUmC4zrqNDaNdWQ4GX6f7nkRcgkhJrnyWUnMoyHht+0dMhcN9uj5PuRJdAH91LZCK 0h1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785767466; x=1786372266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hNoDrCXm49lLgm2lL6InxDz3MAxyPtaZVFbbdYtrWx4=; b=JGYQ/iCreUSc3xmJBUg4NEeLCw1b4jnzMzKD5OZQM1VVHVWUXIxxR4dBejxIxOWMWn W2G5WX6r2GIsT8fRr4lLKdULl13yW5mQhc/hBB3NrHDjUKvoRcdADR9gWq0qpqRHIPvK /AP8Vf5LfXP7Q7djStpGpFJiDvvrjEjsPjIhDER84GiWL6nKpfsuzJ6sRLdq1J6w0+yb SEj6H64UJItWfwrPwz2kxSmOjl4PVQ/cK+Cc90ynooX3FrAoLg1Df3p5R2exXp+F1IOu PhJON0XFeyztrn7QDbt92NKkJU7Mj16zeo1Wn/CEOOduAyOMPY4hcp7Itfo3D9jDbtlJ kc3A== X-Forwarded-Encrypted: i=1; AHgh+RrSVgNf5YwG4C0zLhDU68a5oiWv2m77rTQZSpEEiZV98sJ6MPVsKpTQf3tLq87jdBRx5EM5LlLKL0iAn4I=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2soJYx6oxQJSUPU+9wyZlXG8dUqRFyfPKIWXQ46P1OwkTuJbD TL/ewnbZe3U487TyZd3FpsRi4kLA3hdanOpWL9EkikDTk+4w5R2dAzaAD81OpEniZmY= X-Gm-Gg: AR+sD106qJiD3GHsKemMC8zpZxNPHsm/OgcYpGlh98pCJCUhenHrsOyV7kDc+4SFOxS fQZKeUMOvAAG7uvjwoNK8sbaQVSB9ikTFDSMGHu4u0JhYwJYtyLyFj7s3FWKtGK1MTtmAJHtzG1 lP6WcB7IgBYTx9yTgi92LmhsOvZz27YbD51NXGuy0FLIxzlzvnCbVLUsOYUwK9UJWKcz558zehA 6ruM/SnDDGuJq6A3QF5TbIO7JUkFdBxwZgLqDYcqy1U5uQb0LrwhX6xuBNd3kxBmrbKlQzLroE6 LI4TcXLVHb2C71YD64L4oaKuv5zaauVCdAnrpQreerRzeFqrCOytBy7Sm79WkaYlBhZUnVDV2pW UsJ8u03IPXFxxJQaxn48t5tHwzm1R3UCQ4rDk2bJrZIkXcGIrKzi9GoVWtj64YVjUbYdhLTEBTm M3xJ8rTi7DGZtejFJviFgUQH02nT+oj85Vqh+zXm5ix9DJoJ59V5lTvi2u2ykxVR6Y4YKZ8/VTx mJorVbrc6sMsjlGiLjTRZrsF6M1Cg+B01C6CWwfhA== X-Received: by 2002:a05:600d:8443:20b0:493:e974:41ac with SMTP id 5b1f17b1804b1-4980c6562c5mr183910265e9.16.1785767466371; Mon, 03 Aug 2026 07:31:06 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b98284sm236575295e9.12.2026.08.03.07.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 07:31:05 -0700 (PDT) From: Muhammad Bilal To: platform-driver-x86@vger.kernel.org Cc: jorge.lopez2@hp.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux@weissschuh.net, linux-kernel@vger.kernel.org, meatuni001@gmail.com, stable@vger.kernel.org Subject: [PATCH 06/13] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop Date: Mon, 3 Aug 2026 19:30:29 +0500 Message-ID: <20260803143037.93105-7-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260803143037.93105-1-meatuni001@gmail.com> References: <20260803143037.93105-1-meatuni001@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PREREQUISITES loop earlier in the same function checks "elem + reqs" against password_obj_count before indexing the ACPI package element array: if (elem + reqs >= password_obj_count) { pr_err("Error elem-objects package is too small\n"); return -EINVAL; } The PSWD_ENCODINGS loop performs the identical indexing pattern, password_obj[elem + pos_values], with no equivalent check, causing an out-of-bounds read of the package element array whenever encodings_size is larger than the number of elements actually present. Fix by adding the same bounds check, matching PREREQUISITES. Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes") Cc: stable@vger.kernel.org Signed-off-by: Muhammad Bilal --- 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 86fa03a5ee9a..acb123985ede 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -351,6 +351,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.55.0