diff options
Diffstat (limited to 'fs/signalfd.c')
-rw-r--r-- | fs/signalfd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c index 7b941abbcde0..a8e293d30034 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -56,12 +56,18 @@ static int signalfd_lock(struct signalfd_ctx *ctx, struct signalfd_lockctx *lk) | |||
56 | sighand = lock_task_sighand(lk->tsk, &lk->flags); | 56 | sighand = lock_task_sighand(lk->tsk, &lk->flags); |
57 | rcu_read_unlock(); | 57 | rcu_read_unlock(); |
58 | 58 | ||
59 | if (sighand && !ctx->tsk) { | 59 | if (!sighand) |
60 | return 0; | ||
61 | |||
62 | if (!ctx->tsk) { | ||
60 | unlock_task_sighand(lk->tsk, &lk->flags); | 63 | unlock_task_sighand(lk->tsk, &lk->flags); |
61 | sighand = NULL; | 64 | return 0; |
62 | } | 65 | } |
63 | 66 | ||
64 | return sighand != NULL; | 67 | if (lk->tsk->tgid == current->tgid) |
68 | lk->tsk = current; | ||
69 | |||
70 | return 1; | ||
65 | } | 71 | } |
66 | 72 | ||
67 | static void signalfd_unlock(struct signalfd_lockctx *lk) | 73 | static void signalfd_unlock(struct signalfd_lockctx *lk) |
@@ -331,7 +337,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
331 | 337 | ||
332 | init_waitqueue_head(&ctx->wqh); | 338 | init_waitqueue_head(&ctx->wqh); |
333 | ctx->sigmask = sigmask; | 339 | ctx->sigmask = sigmask; |
334 | ctx->tsk = current; | 340 | ctx->tsk = current->group_leader; |
335 | 341 | ||
336 | sighand = current->sighand; | 342 | sighand = current->sighand; |
337 | /* | 343 | /* |