sched: Fix __sched_setscheduler() nice test
sched: Fix __sched_setscheduler() nice test

With the introduction of sched_attr::sched_nice we need to check
if we've got permission to actually change the nice value.

Daniel found that can_nice() would always fail; and upon
inspection it turns out that can_nice() only tests to see if we
can lower the nice value, but it doesn't validate if we're
lowering or not.

Therefore amend the test to only call can_nice() when we lower
the nice value.

Reported-and-Tested-by: Daniel Lezcano <e9fa45941f2ebe89c1b9d6c5f339ab42eadb8567@linaro.org>
Signed-off-by: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: d76701c8994d429ae27f3beb6ae5506d2b99b818@linux.it
Cc: bdc6bcd4e8b34b4b92413d758024aeca6da0e459@gmail.com
Cc: Daniel Lezcano <e9fa45941f2ebe89c1b9d6c5f339ab42eadb8567@linaro.org>
Fixes: d50dde5a10f3 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI")
Link: ca1d3c2980d9278bc433cff16e7442344518e8b2@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs