]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - mm/mempolicy.c
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
[net-next-2.6.git] / mm / mempolicy.c
index 75751012c552066f3e5f53329933d3f751cacb10..5bc0a96beb51b550b69389998fc3e09053ee5a2f 100644 (file)
@@ -2094,27 +2094,29 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
                NODEMASK_SCRATCH(scratch);
 
                if (!scratch)
-                       return;
+                       goto put_mpol;
                /* contextualize the tmpfs mount point mempolicy */
                new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask);
                if (IS_ERR(new))
-                       goto put_free; /* no valid nodemask intersection */
+                       goto free_scratch; /* no valid nodemask intersection */
 
                task_lock(current);
                ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch);
                task_unlock(current);
-               mpol_put(mpol); /* drop our ref on sb mpol */
                if (ret)
-                       goto put_free;
+                       goto put_new;
 
                /* Create pseudo-vma that contains just the policy */
                memset(&pvma, 0, sizeof(struct vm_area_struct));
                pvma.vm_end = TASK_SIZE;        /* policy covers entire file */
                mpol_set_shared_policy(sp, &pvma, new); /* adds ref */
 
-put_free:
+put_new:
                mpol_put(new);                  /* drop initial ref */
+free_scratch:
                NODEMASK_SCRATCH_FREE(scratch);
+put_mpol:
+               mpol_put(mpol); /* drop our incoming ref on sb mpol */
        }
 }