tools headers UAPI: Synch KVM's svm.h header with the kernel
[linux-2.6-microblaze.git] / kernel / sys.c
index 9de46a4..ef1a78f 100644 (file)
@@ -479,7 +479,7 @@ static int set_user(struct cred *new)
         * for programs doing set*uid()+execve() by harmlessly deferring the
         * failure to the execve() stage.
         */
-       if (atomic_read(&new_user->processes) >= rlimit(RLIMIT_NPROC) &&
+       if (is_ucounts_overlimit(new->ucounts, UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC)) &&
                        new_user != INIT_USER)
                current->flags |= PF_NPROC_EXCEEDED;
        else
@@ -558,6 +558,10 @@ long __sys_setreuid(uid_t ruid, uid_t euid)
        if (retval < 0)
                goto error;
 
+       retval = set_cred_ucounts(new);
+       if (retval < 0)
+               goto error;
+
        return commit_creds(new);
 
 error:
@@ -616,6 +620,10 @@ long __sys_setuid(uid_t uid)
        if (retval < 0)
                goto error;
 
+       retval = set_cred_ucounts(new);
+       if (retval < 0)
+               goto error;
+
        return commit_creds(new);
 
 error:
@@ -691,6 +699,10 @@ long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
        if (retval < 0)
                goto error;
 
+       retval = set_cred_ucounts(new);
+       if (retval < 0)
+               goto error;
+
        return commit_creds(new);
 
 error: