aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>2008-02-14 13:27:00 -0500
committerIngo Molnar <mingo@elte.hu>2008-02-25 10:34:17 -0500
commitd6643d12cb0885d06a1491b16c1476abcbd53d40 (patch)
treef342c01a278486e47a973cc84ffac72c43b57c64 /fs/proc
parentae0027869db7d28563cd783865fab04ffd18419c (diff)
latencytop: fix memory leak on latency proc file
At lstats_open(), calling get_proc_task() gets task struct, but it never put. put_task_struct() should be called when releasing. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 989e3078d7af..85e06e498078 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -360,6 +360,15 @@ static int lstats_open(struct inode *inode, struct file *file)
360 return ret; 360 return ret;
361} 361}
362 362
363static int lstats_release(struct inode *inode, struct file *file)
364{
365 struct seq_file *m = file->private_data;
366 struct task_struct *task = m->private;
367
368 put_task_struct(task);
369 return single_release(inode, file);
370}
371
363static ssize_t lstats_write(struct file *file, const char __user *buf, 372static ssize_t lstats_write(struct file *file, const char __user *buf,
364 size_t count, loff_t *offs) 373 size_t count, loff_t *offs)
365{ 374{
@@ -378,7 +387,7 @@ static const struct file_operations proc_lstats_operations = {
378 .read = seq_read, 387 .read = seq_read,
379 .write = lstats_write, 388 .write = lstats_write,
380 .llseek = seq_lseek, 389 .llseek = seq_lseek,
381 .release = single_release, 390 .release = lstats_release,
382}; 391};
383 392
384#endif 393#endif