task_nommu.c (a1f817dc8ed79cdff2b76bc51d545fb9465982be) task_nommu.c (388f79345502232d335467e8fa6f8e55a18844e1)
1
2#include <linux/mm.h>
3#include <linux/file.h>
4#include <linux/fdtable.h>
5#include <linux/fs_struct.h>
6#include <linux/mount.h>
7#include <linux/ptrace.h>
8#include <linux/slab.h>

--- 205 unchanged lines hidden (view full) ---

214 loff_t n = *pos;
215
216 /* pin the task and mm whilst we play with them */
217 priv->task = get_proc_task(priv->inode);
218 if (!priv->task)
219 return ERR_PTR(-ESRCH);
220
221 mm = priv->mm;
1
2#include <linux/mm.h>
3#include <linux/file.h>
4#include <linux/fdtable.h>
5#include <linux/fs_struct.h>
6#include <linux/mount.h>
7#include <linux/ptrace.h>
8#include <linux/slab.h>

--- 205 unchanged lines hidden (view full) ---

214 loff_t n = *pos;
215
216 /* pin the task and mm whilst we play with them */
217 priv->task = get_proc_task(priv->inode);
218 if (!priv->task)
219 return ERR_PTR(-ESRCH);
220
221 mm = priv->mm;
222 if (!mm || !atomic_inc_not_zero(&mm->mm_users))
222 if (!mm || !mmget_not_zero(mm))
223 return NULL;
224
225 down_read(&mm->mmap_sem);
226 /* start from the Nth VMA */
227 for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
228 if (n-- == 0)
229 return p;
230

--- 98 unchanged lines hidden ---
223 return NULL;
224
225 down_read(&mm->mmap_sem);
226 /* start from the Nth VMA */
227 for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
228 if (n-- == 0)
229 return p;
230

--- 98 unchanged lines hidden ---