diff --git a/syscall/process_syscall.c b/syscall/process_syscall.c index 59d914f784bdfb37781b8e7c142fe251527d80f9..7f6dd877a671165a1620dd6f67af1deb77ca978f 100644 --- a/syscall/process_syscall.c +++ b/syscall/process_syscall.c @@ -109,17 +109,17 @@ static int OsUserTaskSchedulerSet(unsigned int tid, int policy, const LosSchedPa } taskCB->ops->schedParamGet(taskCB, ¶m); +#ifdef LOSCFG_SECURITY_CAPABILITY + /* user mode process with privilege of CAP_SCHED_SETPRIORITY can change the priority */ + if (!IsCapPermit(CAP_SCHED_SETPRIORITY)) { + SCHEDULER_UNLOCK(intSave); + return EPERM; + } +#endif param.policy = (policyFlag == true) ? (UINT16)policy : param.policy; if ((param.policy == LOS_SCHED_RR) || (param.policy == LOS_SCHED_FIFO)) { param.priority = schedParam->priority; } else if (param.policy == LOS_SCHED_DEADLINE) { -#ifdef LOSCFG_SECURITY_CAPABILITY - /* user mode process with privilege of CAP_SCHED_SETPRIORITY can change the priority */ - if (!IsCapPermit(CAP_SCHED_SETPRIORITY)) { - SCHEDULER_UNLOCK(intSave); - return EPERM; - } -#endif param.runTimeUs = schedParam->runTimeUs; param.deadlineUs = schedParam->deadlineUs; param.periodUs = schedParam->periodUs;