Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 725aad24 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Linus Torvalds
Browse files

__sched_setscheduler: don't do any policy checks when not "user"



The "user" parameter to __sched_setscheduler indicates whether the
change is being done on behalf of a user process or not.  If not, we
shouldn't apply any permissions checks, so don't call
security_task_setscheduler().

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@goop.org>
Tested-by: default avatarSteve Wise <swise@opengridcomputing.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5941de8e
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -5004,19 +5004,21 @@ recheck:
			return -EPERM;
	}

	if (user) {
#ifdef CONFIG_RT_GROUP_SCHED
		/*
		 * Do not allow realtime tasks into groups that have no runtime
		 * assigned.
		 */
	if (user
	    && rt_policy(policy) && task_group(p)->rt_bandwidth.rt_runtime == 0)
		if (rt_policy(policy) && task_group(p)->rt_bandwidth.rt_runtime == 0)
			return -EPERM;
#endif

		retval = security_task_setscheduler(p, policy, param);
		if (retval)
			return retval;
	}

	/*
	 * make sure no PI-waiters arrive (or leave) while we are
	 * changing the priority of the task: