mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
platform/x86: ISST: Validate socket ID in clos_assoc ioctl
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: 12a7d2cb81 ("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 <sammiee5311@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/20260807144003.3498972-2-sammiee5311@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
3921bb8635
commit
a89f07db0c
|
|
@ -729,7 +729,7 @@ static long isst_if_clos_assoc(void __user *argp)
|
|||
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 __user *argp)
|
|||
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user