aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/mempolicy.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ade57322fa2a..0c73c8b814cd 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1995,26 +1995,22 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
1995 return; 1995 return;
1996 /* contextualize the tmpfs mount point mempolicy */ 1996 /* contextualize the tmpfs mount point mempolicy */
1997 new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); 1997 new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask);
1998 if (IS_ERR(new)) { 1998 if (IS_ERR(new))
1999 mpol_put(mpol); /* drop our ref on sb mpol */ 1999 goto put_free; /* no valid nodemask intersection */
2000 NODEMASK_SCRATCH_FREE(scratch);
2001 return; /* no valid nodemask intersection */
2002 }
2003 2000
2004 task_lock(current); 2001 task_lock(current);
2005 ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch); 2002 ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch);
2006 task_unlock(current); 2003 task_unlock(current);
2007 mpol_put(mpol); /* drop our ref on sb mpol */ 2004 mpol_put(mpol); /* drop our ref on sb mpol */
2008 if (ret) { 2005 if (ret)
2009 NODEMASK_SCRATCH_FREE(scratch); 2006 goto put_free;
2010 mpol_put(new);
2011 return;
2012 }
2013 2007
2014 /* Create pseudo-vma that contains just the policy */ 2008 /* Create pseudo-vma that contains just the policy */
2015 memset(&pvma, 0, sizeof(struct vm_area_struct)); 2009 memset(&pvma, 0, sizeof(struct vm_area_struct));
2016 pvma.vm_end = TASK_SIZE; /* policy covers entire file */ 2010 pvma.vm_end = TASK_SIZE; /* policy covers entire file */
2017 mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ 2011 mpol_set_shared_policy(sp, &pvma, new); /* adds ref */
2012
2013put_free:
2018 mpol_put(new); /* drop initial ref */ 2014 mpol_put(new); /* drop initial ref */
2019 NODEMASK_SCRATCH_FREE(scratch); 2015 NODEMASK_SCRATCH_FREE(scratch);
2020 } 2016 }