aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 20ccfb5da6af..9814e43fb23b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -162,6 +162,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
162 if (niceval > 19) 162 if (niceval > 19)
163 niceval = 19; 163 niceval = 19;
164 164
165 rcu_read_lock();
165 read_lock(&tasklist_lock); 166 read_lock(&tasklist_lock);
166 switch (which) { 167 switch (which) {
167 case PRIO_PROCESS: 168 case PRIO_PROCESS:
@@ -199,6 +200,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
199 } 200 }
200out_unlock: 201out_unlock:
201 read_unlock(&tasklist_lock); 202 read_unlock(&tasklist_lock);
203 rcu_read_unlock();
202out: 204out:
203 return error; 205 return error;
204} 206}
@@ -220,6 +222,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
220 if (which > PRIO_USER || which < PRIO_PROCESS) 222 if (which > PRIO_USER || which < PRIO_PROCESS)
221 return -EINVAL; 223 return -EINVAL;
222 224
225 rcu_read_lock();
223 read_lock(&tasklist_lock); 226 read_lock(&tasklist_lock);
224 switch (which) { 227 switch (which) {
225 case PRIO_PROCESS: 228 case PRIO_PROCESS:
@@ -265,6 +268,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
265 } 268 }
266out_unlock: 269out_unlock:
267 read_unlock(&tasklist_lock); 270 read_unlock(&tasklist_lock);
271 rcu_read_unlock();
268 272
269 return retval; 273 return retval;
270} 274}
@@ -567,13 +571,7 @@ static int set_user(struct cred *new)
567 if (!new_user) 571 if (!new_user)
568 return -EAGAIN; 572 return -EAGAIN;
569 573
570 if (!task_can_switch_user(new_user, current)) { 574 if (atomic_read(&new_user->processes) >= rlimit(RLIMIT_NPROC) &&
571 free_uid(new_user);
572 return -EINVAL;
573 }
574
575 if (atomic_read(&new_user->processes) >=
576 current->signal->rlim[RLIMIT_NPROC].rlim_cur &&
577 new_user != INIT_USER) { 575 new_user != INIT_USER) {
578 free_uid(new_user); 576 free_uid(new_user);
579 return -EAGAIN; 577 return -EAGAIN;