aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bc1638b33449..0acf96b790c5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3558,9 +3558,10 @@ static int _sched_setscheduler(struct task_struct *p, int policy,
3558 }; 3558 };
3559 3559
3560 /* 3560 /*
3561 * Fixup the legacy SCHED_RESET_ON_FORK hack 3561 * Fixup the legacy SCHED_RESET_ON_FORK hack, except if
3562 * the policy=-1 was passed by sched_setparam().
3562 */ 3563 */
3563 if (policy & SCHED_RESET_ON_FORK) { 3564 if ((policy != -1) && (policy & SCHED_RESET_ON_FORK)) {
3564 attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK; 3565 attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
3565 policy &= ~SCHED_RESET_ON_FORK; 3566 policy &= ~SCHED_RESET_ON_FORK;
3566 attr.sched_policy = policy; 3567 attr.sched_policy = policy;