lkml.org 
[lkml]   [2011]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] proc: do cleanup in m_start() rather than m_stop()
Date
In the future, we will not call ->stop() anymore when ->start() fails,
so ->start() is responsible to do cleanups within itself.

Signed-off-by: Amerigo Wang <amwang@redhat.com>
---
fs/proc/task_mmu.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 3c06570..9ebbe20 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -124,8 +124,10 @@ static void *m_start(struct seq_file *m, loff_t *pos)
return ERR_PTR(-ESRCH);

mm = mm_for_maps(priv->task);
- if (IS_ERR_OR_NULL(mm))
+ if (IS_ERR_OR_NULL(mm)) {
+ put_task_struct(priv->task);
return mm;
+ }
down_read(&mm->mmap_sem);

tail_vma = get_gate_vma(priv->task->mm);
@@ -182,8 +184,9 @@ static void m_stop(struct seq_file *m, void *v)
struct proc_maps_private *priv = m->private;
struct vm_area_struct *vma = v;

- if (!IS_ERR_OR_NULL(vma))
- vma_stop(priv, vma);
+ if (IS_ERR_OR_NULL(vma))
+ return;
+ vma_stop(priv, vma);
if (priv->task)
put_task_struct(priv->task);
}
--
1.7.4


\
 
 \ /
  Last update: 2011-03-28 09:11    [W:0.053 / U:25.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site