diff options
author | Andi Kleen <andi@basil.nowhere.org> | 2006-11-21 04:22:09 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-11-21 04:22:09 -0500 |
commit | 1b7f6a626f0ff511c3840678466cbfe1d62c0b29 (patch) | |
tree | 415e8c838c0067bff384afb8a2c91e5f7c6d11d3 /kernel/signal.c | |
parent | b3edc9cec07ade41aaf1804f7c9e876afa90c862 (diff) | |
parent | 3f5a6ca31c334011fd929501a078424c0d3f71be (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 7ed8d5304bec..df18c167a2a7 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -267,18 +267,25 @@ static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, | |||
267 | int override_rlimit) | 267 | int override_rlimit) |
268 | { | 268 | { |
269 | struct sigqueue *q = NULL; | 269 | struct sigqueue *q = NULL; |
270 | struct user_struct *user; | ||
270 | 271 | ||
271 | atomic_inc(&t->user->sigpending); | 272 | /* |
273 | * In order to avoid problems with "switch_user()", we want to make | ||
274 | * sure that the compiler doesn't re-load "t->user" | ||
275 | */ | ||
276 | user = t->user; | ||
277 | barrier(); | ||
278 | atomic_inc(&user->sigpending); | ||
272 | if (override_rlimit || | 279 | if (override_rlimit || |
273 | atomic_read(&t->user->sigpending) <= | 280 | atomic_read(&user->sigpending) <= |
274 | t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur) | 281 | t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur) |
275 | q = kmem_cache_alloc(sigqueue_cachep, flags); | 282 | q = kmem_cache_alloc(sigqueue_cachep, flags); |
276 | if (unlikely(q == NULL)) { | 283 | if (unlikely(q == NULL)) { |
277 | atomic_dec(&t->user->sigpending); | 284 | atomic_dec(&user->sigpending); |
278 | } else { | 285 | } else { |
279 | INIT_LIST_HEAD(&q->list); | 286 | INIT_LIST_HEAD(&q->list); |
280 | q->flags = 0; | 287 | q->flags = 0; |
281 | q->user = get_uid(t->user); | 288 | q->user = get_uid(user); |
282 | } | 289 | } |
283 | return(q); | 290 | return(q); |
284 | } | 291 | } |