]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/signal.c
CRED: Inaugurate COW credentials
[linux-2.6-omap-h63xx.git] / kernel / signal.c
index 84989124bafbaf9344e0aa3e3d6aabc78969f310..2a64304ed54b041c327f64910f0cf84ee5a64e2f 100644 (file)
@@ -180,7 +180,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 /*
  * allocate a new signal queue record
  * - this may be called without locks if and only if t == current, otherwise an
- *   appopriate lock must be held to protect t's user_struct
+ *   appopriate lock must be held to stop the target task from exiting
  */
 static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags,
                                         int override_rlimit)
@@ -194,7 +194,7 @@ static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags,
         * caller must be holding the RCU readlock (by way of a spinlock) and
         * we use RCU protection here
         */
-       user = __task_cred(t)->user;
+       user = get_uid(__task_cred(t)->user);
        atomic_inc(&user->sigpending);
        if (override_rlimit ||
            atomic_read(&user->sigpending) <=
@@ -202,12 +202,14 @@ static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags,
                q = kmem_cache_alloc(sigqueue_cachep, flags);
        if (unlikely(q == NULL)) {
                atomic_dec(&user->sigpending);
+               free_uid(user);
        } else {
                INIT_LIST_HEAD(&q->list);
                q->flags = 0;
-               q->user = get_uid(user);
+               q->user = user;
        }
-       return(q);
+
+       return q;
 }
 
 static void __sigqueue_free(struct sigqueue *q)