mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 17:42:03 +02:00
platform/x86: ISST: Validate parameter for core power state
Allow only 0 or 1 for core_power enable and priority_type parameters.
Fixes: 12a7d2cb81 ("platform/x86: ISST: Add SST-CP support via TPMI")
Cc: stable@vger.kernel.org
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/20260811221514.3905817-4-srinivas.pandruvada@linux.intel.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
e45d6b8472
commit
1700b4f804
|
|
@ -599,6 +599,9 @@ static bool disable_dynamic_sst_features(void)
|
|||
#define SST_CP_PRIORITY_TYPE_START 1
|
||||
#define SST_CP_PRIORITY_TYPE_WIDTH 1
|
||||
|
||||
#define SST_CP_MAX_ENABLE 1
|
||||
#define SST_CP_MAX_PRIORITY_TYPE 1
|
||||
|
||||
static long isst_if_core_power_state(void __user *argp)
|
||||
{
|
||||
struct tpmi_per_power_domain_info *power_domain_info;
|
||||
|
|
@ -618,6 +621,10 @@ static long isst_if_core_power_state(void __user *argp)
|
|||
if (power_domain_info->write_blocked || !capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (core_power.enable > SST_CP_MAX_ENABLE ||
|
||||
core_power.priority_type > SST_CP_MAX_PRIORITY_TYPE)
|
||||
return -EINVAL;
|
||||
|
||||
_write_cp_info("cp_enable", core_power.enable, SST_CP_CONTROL_OFFSET,
|
||||
SST_CP_ENABLE_START, SST_CP_ENABLE_WIDTH, SST_MUL_FACTOR_NONE)
|
||||
_write_cp_info("cp_prio_type", core_power.priority_type, SST_CP_CONTROL_OFFSET,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user