From: Peter Williams Date: Mon, 26 Jun 2006 06:58:00 +0000 (+1000) Subject: [PATCH] sched: fix SCHED_FIFO bug in sys_sched_rr_get_interval() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b78709cfd4387c15a9894748bcada8a4ca75c561;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [PATCH] sched: fix SCHED_FIFO bug in sys_sched_rr_get_interval() The introduction of SCHED_BATCH scheduling class with a value of 3 means that the expression (p->policy & SCHED_FIFO) will return true if policy is SCHED_BATCH or SCHED_FIFO. Unfortunately, this expression is used in sys_sched_rr_get_interval() and in the absence of a comment to say that this is intentional I presume that it is unintentional and erroneous. The fix is to change the expression to (p->policy == SCHED_FIFO). Acked-by: Ingo Molnar Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched.c b/kernel/sched.c index f06d059edef..cfaf3fabeec 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4247,7 +4247,7 @@ long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval) if (retval) goto out_unlock; - jiffies_to_timespec(p->policy & SCHED_FIFO ? + jiffies_to_timespec(p->policy == SCHED_FIFO ? 0 : task_timeslice(p), &t); read_unlock(&tasklist_lock); retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;