]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/mempolicy.c
[JFFS2][XATTR] Fix memory leak in POSIX-ACL support
[linux-2.6-omap-h63xx.git] / mm / mempolicy.c
index 05b84acf0bb33ad20ccf9914c23d883a8c42d01c..6b9740bbf4c0199cee2096ad6e6544d4c6b8a255 100644 (file)
@@ -88,6 +88,7 @@
 #include <linux/proc_fs.h>
 #include <linux/migrate.h>
 #include <linux/rmap.h>
+#include <linux/security.h>
 
 #include <asm/tlbflush.h>
 #include <asm/uaccess.h>
@@ -631,6 +632,10 @@ int do_migrate_pages(struct mm_struct *mm,
 
        down_read(&mm->mmap_sem);
 
+       err = migrate_vmas(mm, from_nodes, to_nodes, flags);
+       if (err)
+               goto out;
+
 /*
  * Find a 'source' bit set in 'tmp' whose corresponding 'dest'
  * bit in 'to' is not also set in 'tmp'.  Clear the found 'source'
@@ -690,7 +695,7 @@ int do_migrate_pages(struct mm_struct *mm,
                if (err < 0)
                        break;
        }
-
+out:
        up_read(&mm->mmap_sem);
        if (err < 0)
                return err;
@@ -942,6 +947,10 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
                goto out;
        }
 
+       err = security_task_movememory(task);
+       if (err)
+               goto out;
+
        err = do_migrate_pages(mm, &old, &new,
                capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
 out:
@@ -1812,7 +1821,7 @@ static inline void check_huge_range(struct vm_area_struct *vma,
 
 int show_numa_map(struct seq_file *m, void *v)
 {
-       struct task_struct *task = m->private;
+       struct proc_maps_private *priv = m->private;
        struct vm_area_struct *vma = v;
        struct numa_maps *md;
        struct file *file = vma->vm_file;
@@ -1828,7 +1837,7 @@ int show_numa_map(struct seq_file *m, void *v)
                return 0;
 
        mpol_to_str(buffer, sizeof(buffer),
-                       get_vma_policy(task, vma, vma->vm_start));
+                           get_vma_policy(priv->task, vma, vma->vm_start));
 
        seq_printf(m, "%08lx %s", vma->vm_start, buffer);
 
@@ -1882,7 +1891,7 @@ out:
        kfree(md);
 
        if (m->count < m->size)
-               m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0;
+               m->version = (vma != priv->tail_vma) ? vma->vm_start : 0;
        return 0;
 }