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 4BD303D7A01 for ; Mon, 3 Aug 2026 14:31:00 +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=1785767464; cv=none; b=DC4ya4dqYraHncojBztS2MIOUTkPKjEpKyVp3i2GwylFPQkXPhgcd2JQkvpBf9lBbIlla7E+KfNKmlWkIgkWpYsNpx1j8KjwMZBPpeqxvH68VKraN12a1dgH3WD+XW/EtzBdFxzon4S8ckJ3H61apWgdc0pSLDD5KXKP//8IV9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785767464; c=relaxed/simple; bh=r6Cbjl4OVGNVNoYln0kbEziovWGUtHxY0z02La/a0yE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDumYLFoYghgdkHxoKDshfeu9Nks0jPiPY9JaQKe3BRc98DeVl9W2VTK/QWpUboXKkwVvlRj/UgMVifxJxTKi6/n7QNWdXMYYJrQ4wu2Cumatn1EGABrGjKNavCjZQNFqJEN+gjnH+xOBK84eE/7B890O/AAxHGU0S/W+EuofH8= 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=QWayDztU; 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="QWayDztU" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4955aa106b1so20050585e9.0 for ; Mon, 03 Aug 2026 07:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785767458; x=1786372258; 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=PdRDhdZcnRfVrf9wRzs0djvfPZrw61+L7S7NLduJJu4=; b=QWayDztU8it3Z5kTxP2qIecS6McYqBN5ZIAauyqoelfQPiwQ5IgtzqJWwFtCa/aPkU tqeS3AyD80t3lz60mJqFqOBLMSO9VPNUgnpvcfQGIgatmokTPf0pHJG179hbmDZELOjC NGXaFqKU5surkpjguKyxyXSgiYiX/AGK2Zpn7lSmBdogkgCliHxRwmTOTaGeGlL85IoN zrm+H5rVta6yvf9JmqzQkugYhvFg2m65cDkbkIH92x6TJ/4sQie7XNqqLxbIy9lMD5YR Y5oPq7F77fOtxQqw1oA4Hkfp4Gyxw3boiDAe3Sz5vzCNieDadPPtrc2Kd3C5bMm+PBq4 0L/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785767458; x=1786372258; 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=PdRDhdZcnRfVrf9wRzs0djvfPZrw61+L7S7NLduJJu4=; b=H4fc0dNhZBl47yT/0lgNtnJZeNJJc4fmv9VJSuC4ESAtK1+c6k3O2jCafgbDqDemlR M414xb8QzAyPv603EX/8Dv6cKaCvsnk0+RwA4TY1F3eh4O3cqykOcuAc3Q00POf51/Wy s3xjln5ZFkQ2CZCmS/Y3K2M+4JIvOEghN4WKFbzFS6np/N6LVQ4bC0qsJAXyr8EB0o3g 8IYu/DTCOkcUa4bU2fJS+FOrF2AjWhsT/1gmcwcOvdg0nWx9oLGYn2Bfl10hRH/8VKDv 5q9HfGYdHST0TdYbRU4yk4nLeLc/4WwNXVuY+v7973iKGk649IRv3CzSMnXq9e14hGKS iOpw== X-Forwarded-Encrypted: i=1; AHgh+RoySOYu8s+KJvBvkX0AL4TJO+apvxXIIrCJEhuVMY2b3TmnkuHFNOI/I/JPKh4sdHffXFQKGaYrkVT5nqk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5yWAKk8xMjgWPVrOqFxabzbvtwQu0BrH1mNtDJx0eDnuQRlEI J3E0UM/3Lb4JRJp4Re9kSSQNsFUErY/H7hmMPsmwQJEzxrAIlidLd5UZ X-Gm-Gg: AR+sD106F2ZMWEZQrQkDr6aAjeI6tWTZMeE/LvK09G3xX3psetKHyDYbWJDiFe3AYY+ sYbnKFVHw+olsJfW4iBCAs/c9dV8qAnJwgX3Ra6f0LdtePf5/ADuAdPnpPnjQVZ3De3pxRwx1Lp S8hTK8Hso7y07guAFNqLsUpxMZ7GQuWbn5CTtn+F8pE8nEjE7kVgXFBp9Oxwb3dt7U4ZVbRwPEL rELOzsostyzf6MwlYqeKZ7LpIkHwoqBpQONc1kuAJ7/uq7aPYFKDtGclX9R2rHta0a5QsIyMqIv 4gBmZBxwZczSWSopWnhgb4/AZaXKuZC8YypP333GRA2H9rH3+KLyUhIGpXOYuJSZrgsMYoAVVwm J2+c+xOw0LOpLb50k4uF2drhWMyQFNMnsIjvcV27XavvpedU7f+toJK5u5wXVeDJZw9vtfH3h7i 4uZLT/U3tfVekdgCSV1ngXFzDMDYJTSi1TQIxA60+qtItY3163dYlQFZ3XG2D+zoCLirre8B2h7 6cxwhobtPCrI1iCcuKcBp6wq/diIz2miVRscyE2Qg== X-Received: by 2002:a05:600d:8489:10b0:495:69eb:27fe with SMTP id 5b1f17b1804b1-4980c674ef9mr180887235e9.11.1785767457599; Mon, 03 Aug 2026 07:30:57 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b98284sm236575295e9.12.2026.08.03.07.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 07:30:57 -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 03/13] platform/x86: hp-bioscfg: fix heap OOB read on empty password write Date: Mon, 3 Aug 2026 19:30:26 +0500 Message-ID: <20260803143037.93105-4-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 validate_password_input() computes length = strlen(buf) and then checks buf[length - 1] to strip a trailing newline, without checking that length is nonzero first. Writing an empty string (a bare '\n') to current_password or new_password gives length == 0, and buf[length - 1] reads buf[-1], one byte before the heap allocation holding the copied input. KASAN confirms this directly: BUG: KASAN: slab-out-of-bounds in store_password_instance.constprop.0+0x223/0x2a0 [hp_bioscfg] Read of size 1 at addr ffff88811bd8da9f by task sh/13740 ... store_password_instance.constprop.0+0x223/0x2a0 [hp_bioscfg] current_password_store+0x14/0x20 [hp_bioscfg] ... The buggy address is located 23 bytes to the right of allocated 8-byte region [ffff88811bd8da80, ffff88811bd8da88) Reproduced identically via new_password_store. Execution continues past the bad read (the garbage byte only affects whether "length" is decremented by one), so the write completes and returns success; this is a pure information read past the buffer, not a crash, but it is still an out-of-bounds access KASAN correctly flags. Fix by only checking buf[length - 1] when length is nonzero. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c index 4d79eb8056a5..86fa03a5ee9a 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -66,7 +66,7 @@ static int validate_password_input(int instance_id, const char *buf) struct password_data *password_data = &bioscfg_drv.password_data[instance_id]; length = strlen(buf); - if (buf[length - 1] == '\n') + if (length > 0 && buf[length - 1] == '\n') length--; if (length > MAX_PASSWD_SIZE) -- 2.55.0