diff options
author | Jiri Slaby <jslaby@suse.cz> | 2010-03-05 13:42:54 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 11:26:33 -0800 |
commit | 78d7d407b62a021e6d2e8dc24c0b90e390ab58a1 (patch) | |
tree | 8c1074b84db4b977bad6802a3701e0113c0a7739 /kernel/sys.c | |
parent | d4bb527438b4181cd3c564ae04dd344c381283a1 (diff) | |
download | op-kernel-dev-78d7d407b62a021e6d2e8dc24c0b90e390ab58a1.zip op-kernel-dev-78d7d407b62a021e6d2e8dc24c0b90e390ab58a1.tar.gz |
kernel core: use helpers for rlimits
Make sure compiler won't do weird things with limits. E.g. fetching them
twice may return 2 different values after writable limits are implemented.
I.e. either use rlimit helpers added in commit 3e10e716abf3 ("resource:
add helpers for fetching rlimits") or ACCESS_ONCE if not applicable.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 877fe4f..9814e43 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -571,8 +571,7 @@ static int set_user(struct cred *new) if (!new_user) return -EAGAIN; - if (atomic_read(&new_user->processes) >= - current->signal->rlim[RLIMIT_NPROC].rlim_cur && + if (atomic_read(&new_user->processes) >= rlimit(RLIMIT_NPROC) && new_user != INIT_USER) { free_uid(new_user); return -EAGAIN; |