From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 7339D4398E4 for ; Wed, 12 Aug 2026 11:18:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786533534; cv=none; b=uqEbTLAlK5fiuwtKPe4ynbQs4CR95CtQNiGsD5gRaOP98puKcb91fGU2/SXbcB0ecFND/B60a3rwrrMu7d/9LsAw8crlMXqOhRc3dsE4mf46BxH/TFUNKIyNY3FhPDzHamFyEyI3g7SbW/nPiQON+DXrCrZk6eO4R9Mvtbynfk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786533534; c=relaxed/simple; bh=rhV+qOT/cedymAeQ3DQaL+LQcUHG8piPrtIkVunzAvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ftQdmucm9nvyw+G7sXY2u/TuObnpPc1g1a/ndlbpTwtXff7WlUDxUk23N2crJWYi3ZGRy5RBLLi3Lm0oWRZgkdg2rFFmmNaNGrcrcCjtMu1bu9n5XO4xG0YDqimWUnM/a75fc6tg8Wqt+XqoUM1Zx+sSzhirt6BGkgAySuwbkUs= 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=El+bs9Sm; arc=none smtp.client-ip=209.85.128.44 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="El+bs9Sm" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49800c6a846so8259015e9.3 for ; Wed, 12 Aug 2026 04:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786533530; x=1787138330; 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=El+bs9SmlR5VflEY64GBmIIQXIbymJJyrUbkoKgDXdttek2k9NrNJ5kx/71CgaEPR6 zssv7Isd40wJNSNdFUzyZ8paFQuvU92g0xbLSrzWkLbQXXAgDwLMdUrouGCms1ZYbbUC 9vyId+qBqtrq4oyWvlZxNL1dXWW+mZSOOJZ7A7GozfrPKNwW34OD1t517kqocku3bz3Y 6gvIrWQscbjKJGXINXkx0GwprlqNZOpl5+s7hTX9XK/tuvMWx438UzC1H0DJG8R+TSOO FtPCAkP99Y1MULZ0AW/kezwl+VPKSQrAxfgG+sVlIUsyjZe9pv9XAQn/ms6f1xy8nz9C t0Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786533530; x=1787138330; 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=tRZfk/TZiWdru4Sx0mbAt1uzbd87r/R1DqZgPiILA+hfjeG5c55/YvXXX0WT/QIti8 lQ4Vs6hU4BLLiHDOgDunHAVayAH+GXRSdsI479s1AS45mNLMWymiWksN1V5i9EZx2gLR tvLm7/xyJkAd8viajJCM+x8bU0nUaFG6J4QuosKiTGb1I7QAf3OtSwNUFajU1tggC9Pf wJAOCD094uk7wHJzyP7YplfZfqGO/9QGg1577I929LEiA1NtPHpa3FcaTIo29+JnxwoD uFnguoXN3WroAP2SL+v8OJhYTnLnFUriOpfapWCpb2MdG3Odw3dz/dGGBxVx2fv28m7J gMGA== X-Forwarded-Encrypted: i=1; AHgh+RonCOtq29kYTVrAdGRqyECFqAAISPBN8EE0Zpjc7z3nJ9sxuESWfdzrURXf8VCWa7a43yPbm7NthlbxNnQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwwV7d4QJqGA7GoVxi8K+RB987gvj1q1rOMqs0Lkl3uvO9Xb0FY nhZPTr94+PZI/dQ1Rc1SCV1oxMlbGPgPKuhnV5Z5IkYDK/9uLzRrCtfL X-Gm-Gg: AR+sD13W39WvWgY+YMxyZh9C/1C84/c1x+4+fFlxqbg2eCvqNFkCseFYYG+Pn4u9tC6 c/iTDgfkR4QUmiJV3Ua4/PlBCStvCMRHmZhnkksPl4aN2soRkTzQy4drR9ih/cOy6saZwz6INT/ 1Qp+/6lPJV8t/0oERFR41vvojSSjp6+ooNmLg/2wga3jPzNsvnpsFy76Uta8PF61D/VIrbET617 Wx4ROPYwz+OIBu44bx7zjkKExUviZuOFrzy4djsbvs2NRYGhcA8izLfLcZdwSl9P0vTQJzokexa RVhjiFK90+Ju2GUyZ9ELL66xfn3V3aDeV0vOYEI7EeRR94CPJl176A+R3QxV1yu8U6GXCXa99SB cc8Jq0OMXhImAK4wlImxaaS6Rw6wC/MoIOauCEAJ0SwlcDkMa1Gjc5e+EN7FSxrhezkFYyuCt/M pRHmqWoBhz9Q7oLT9qTmxrogI+/pLR/Apr6ELwV5uhw+2LRp3rXPSn+Ilw86eELUvYIMWGLNil1 fuQ8tqfuPwSVaM5uHH/8W6hnrd73is+gR/9cdXz1Q== X-Received: by 2002:a05:600c:8209:b0:496:c977:3b6d with SMTP id 5b1f17b1804b1-4997c139b0bmr62363425e9.12.1786533530450; Wed, 12 Aug 2026 04:18:50 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48150d702c9sm6670072f8f.34.2026.08.12.04.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 04:18:50 -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, stable@vger.kernel.org, Muhammad Bilal Subject: [PATCH v2 6/9] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop Date: Wed, 12 Aug 2026 16:18:26 +0500 Message-ID: <20260812111829.172273-7-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260812111829.172273-1-meatuni001@gmail.com> References: <20260812111829.172273-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