From mboxrd@z Thu Jan 1 00:00:00 1970 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 B0ABA411A1C; Fri, 4 Sep 2026 05:30:16 +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=1788499819; cv=none; b=J47425JvV14KFi/N+oLDvFq0Bz29o0hxWvG2Bq9uLodfHoMHbBbr01xGKAYmBvDkja9VizYYtQNVQnTyeenYHFBN+9zrsltDq7G2a35k7i0mJG9uRWh0+pfsBZ7Ul4NXyu4n/sM9k1Mj/NpzWmXW8v4bHGcf1bDxbvs70Cj4bD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499819; c=relaxed/simple; bh=BCuEy0ixpTirPoGchRm8SrJndhCdbw1UX6GVXUzeLQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=akpRk3UGYRm6ebufBoSj78XfRs92fCKKXWW2H+nR2KAwGxZufxPFq2A9Ow06hmrtrVL/BNrGZvpsVGgNyvqdKQG6vJMDnKaGJK59UEdHfjC2UnfVAbR6Q7N6rhnLiOFjrrTxe/tJr7ek7bxkQRyvobAIbnxN+nebiSw8u1pA+4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pxdVYBX5; 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="pxdVYBX5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 179141F00A3D; Fri, 4 Sep 2026 05:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788499816; bh=ommNyVMcxRYVyHR002bp0u5aL2/3lF6VCjByR5s4rIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pxdVYBX5Q5YFUN0VVLQPGiYl5bbq235ibW4+CYzsY19ZpgHdhBvZkxh/c8cezY/bP qXbAuwrNtdICgbg9TauID3yelw7Dr57C2mydxI2iPqryERfQ5YdcMBAdA4+6pc4oB5 qXy+AWyM/Evy8ZP4bBtL1jzKmT2PXXZRjlwSH3Rc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, HyeongJun An , Srinivas Pandruvada , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 7.2 552/713] platform/x86: ISST: Validate socket ID in clos_assoc ioctl Date: Fri, 4 Sep 2026 06:58:40 +0200 Message-ID: <20260904045816.191034677@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045803.810145556@linuxfoundation.org> References: <20260904045803.810145556@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An commit a89f07db0cb95c54dac4a8406c79a04e44a73c3c upstream. isst_if_clos_assoc() validates the user-supplied socket_id with 'socket_id > topology_max_packages()', but isst_common.sst_inst[] is allocated with topology_max_packages() entries, so the valid index range is [0, topology_max_packages()). The '>' comparison lets socket_id == topology_max_packages() pass and index one entry past the array. In addition, isst_common.sst_inst[socket_id] is NULL for an in-range package that has no bound TPMI SST instance, and the pointer is used without a NULL check. Both the out-of-bounds entry and the NULL pointer are then dereferenced by map_partition_power_domain_id() and the following power_domain_info access. Reject socket_id >= topology_max_packages() and a NULL sst_inst, matching the checks already performed by get_instance(). Fixes: 12a7d2cb811d ("platform/x86: ISST: Add SST-CP support via TPMI") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5 Signed-off-by: HyeongJun An Acked-by: Srinivas Pandruvada Link: https://patch.msgid.link/20260807144003.3498972-2-sammiee5311@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -729,7 +729,7 @@ static long isst_if_clos_assoc(void __us if (copy_from_user(&clos_assoc, ptr, sizeof(clos_assoc))) return -EFAULT; - if (clos_assoc.socket_id > topology_max_packages()) + if (clos_assoc.socket_id >= topology_max_packages()) return -EINVAL; cpu = clos_assoc.logical_cpu; @@ -747,6 +747,8 @@ static long isst_if_clos_assoc(void __us pkg_id = clos_assoc.socket_id; sst_inst = isst_common.sst_inst[pkg_id]; + if (!sst_inst) + return -EINVAL; punit_id = map_partition_power_domain_id(sst_inst, punit_id, &part); if (punit_id < 0)