aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/task_mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/task_mmu.c')
-rw-r--r--fs/proc/task_mmu.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 636f1a1fdf87..7c708a418acc 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -121,14 +121,14 @@ static void *m_start(struct seq_file *m, loff_t *pos)
121 121
122 priv->task = get_pid_task(priv->pid, PIDTYPE_PID); 122 priv->task = get_pid_task(priv->pid, PIDTYPE_PID);
123 if (!priv->task) 123 if (!priv->task)
124 return NULL; 124 return ERR_PTR(-ESRCH);
125 125
126 mm = mm_for_maps(priv->task); 126 mm = mm_for_maps(priv->task);
127 if (!mm) 127 if (!mm || IS_ERR(mm))
128 return NULL; 128 return mm;
129 down_read(&mm->mmap_sem); 129 down_read(&mm->mmap_sem);
130 130
131 tail_vma = get_gate_vma(priv->task); 131 tail_vma = get_gate_vma(priv->task->mm);
132 priv->tail_vma = tail_vma; 132 priv->tail_vma = tail_vma;
133 133
134 /* Start with last addr hint */ 134 /* Start with last addr hint */
@@ -279,7 +279,8 @@ static int show_map(struct seq_file *m, void *v)
279 show_map_vma(m, vma); 279 show_map_vma(m, vma);
280 280
281 if (m->count < m->size) /* vma is copied successfully */ 281 if (m->count < m->size) /* vma is copied successfully */
282 m->version = (vma != get_gate_vma(task))? vma->vm_start: 0; 282 m->version = (vma != get_gate_vma(task->mm))
283 ? vma->vm_start : 0;
283 return 0; 284 return 0;
284} 285}
285 286
@@ -468,7 +469,8 @@ static int show_smap(struct seq_file *m, void *v)
468 (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0); 469 (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);
469 470
470 if (m->count < m->size) /* vma is copied successfully */ 471 if (m->count < m->size) /* vma is copied successfully */
471 m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; 472 m->version = (vma != get_gate_vma(task->mm))
473 ? vma->vm_start : 0;
472 return 0; 474 return 0;
473} 475}
474 476
@@ -764,8 +766,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
764 if (!task) 766 if (!task)
765 goto out; 767 goto out;
766 768
767 ret = -EACCES; 769 mm = mm_for_maps(task);
768 if (!ptrace_may_access(task, PTRACE_MODE_READ)) 770 ret = PTR_ERR(mm);
771 if (!mm || IS_ERR(mm))
769 goto out_task; 772 goto out_task;
770 773
771 ret = -EINVAL; 774 ret = -EINVAL;
@@ -778,10 +781,6 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
778 if (!count) 781 if (!count)
779 goto out_task; 782 goto out_task;
780 783
781 mm = get_task_mm(task);
782 if (!mm)
783 goto out_task;
784
785 pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); 784 pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
786 pm.buffer = kmalloc(pm.len, GFP_TEMPORARY); 785 pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
787 ret = -ENOMEM; 786 ret = -ENOMEM;