diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-10-28 13:38:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 14:30:54 -0400 |
commit | 093a8e8aecd77b2799934996a55a6838e1e2b8f3 (patch) | |
tree | ece87b2e194494059b2d4aaa43a094786dac1db7 /include | |
parent | 05d5bcd60e8202e5c7b28cf61186043a4d612623 (diff) |
[PATCH] taskstats_tgid_free: fix usage
taskstats_tgid_free() is called on copy_process's error path. This is wrong.
IF (clone_flags & CLONE_THREAD)
We should not clear ->signal->taskstats, current uses it,
it probably has a valid accumulated info.
ELSE
taskstats_tgid_init() set ->signal->taskstats = NULL,
there is nothing to free.
Move the callsite to __exit_signal(). We don't need any locking, entire
thread group is exiting, nobody should have a reference to soon to be
released ->signal.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/taskstats_kern.h | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h index 16894b7edcc8..a437ca0d226b 100644 --- a/include/linux/taskstats_kern.h +++ b/include/linux/taskstats_kern.h | |||
@@ -49,17 +49,8 @@ static inline void taskstats_tgid_alloc(struct signal_struct *sig) | |||
49 | 49 | ||
50 | static inline void taskstats_tgid_free(struct signal_struct *sig) | 50 | static inline void taskstats_tgid_free(struct signal_struct *sig) |
51 | { | 51 | { |
52 | struct taskstats *stats = NULL; | 52 | if (sig->stats) |
53 | unsigned long flags; | 53 | kmem_cache_free(taskstats_cache, sig->stats); |
54 | |||
55 | spin_lock_irqsave(&sig->stats_lock, flags); | ||
56 | if (sig->stats) { | ||
57 | stats = sig->stats; | ||
58 | sig->stats = NULL; | ||
59 | } | ||
60 | spin_unlock_irqrestore(&sig->stats_lock, flags); | ||
61 | if (stats) | ||
62 | kmem_cache_free(taskstats_cache, stats); | ||
63 | } | 54 | } |
64 | 55 | ||
65 | extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); | 56 | extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); |