mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 09:41:03 +02:00
platform/x86: ISST: Validate parameter for frequency and priority
Validate range for frequency and proportional priority while setting
CLOS 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-5-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
1700b4f804
commit
574b59bb4b
|
|
@ -658,6 +658,9 @@ static long isst_if_core_power_state(void __user *argp)
|
|||
|
||||
#define SST_MAX_CLOS 3
|
||||
|
||||
#define SST_MAX_FREQ 0xff
|
||||
#define SST_CLOS_MAX_PRIORITY 0x0f
|
||||
|
||||
static long isst_if_clos_param(void __user *argp)
|
||||
{
|
||||
struct tpmi_per_power_domain_info *power_domain_info;
|
||||
|
|
@ -677,6 +680,15 @@ static long isst_if_clos_param(void __user *argp)
|
|||
if (power_domain_info->write_blocked || !capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!in_range(clos_param.min_freq_mhz / SST_MUL_FACTOR_FREQ, 0, SST_MAX_FREQ + 1))
|
||||
return -EINVAL;
|
||||
|
||||
if (!in_range(clos_param.max_freq_mhz / SST_MUL_FACTOR_FREQ, 0, SST_MAX_FREQ + 1))
|
||||
return -EINVAL;
|
||||
|
||||
if (!in_range(clos_param.prop_prio, 0, SST_CLOS_MAX_PRIORITY + 1))
|
||||
return -EINVAL;
|
||||
|
||||
_write_cp_info("clos.min_freq", clos_param.min_freq_mhz,
|
||||
(SST_CLOS_CONFIG_0_OFFSET + clos_param.clos * SST_REG_SIZE),
|
||||
SST_CLOS_CONFIG_MIN_START, SST_CLOS_CONFIG_MIN_WIDTH,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user