From f7a011acfddd63fded87ab42d30a6fd3dbca5a6d Mon Sep 17 00:00:00 2001 From: Lee Schermerhorn Date: Mon, 28 Apr 2008 02:13:11 -0700 Subject: [PATCH] --- yaml --- r: 94033 b: refs/heads/master c: ae4d8c16aa22775f5731677abb8a82f03cec877e h: refs/heads/master i: 94031: 57ee0478fc5ef322c6df12af7f9216b0e568e3fb v: v3 --- [refs] | 2 +- trunk/ipc/shm.c | 3 +-- trunk/mm/mempolicy.c | 7 +++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 2a69aefb95fb..b0a3ab9804ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f4e53d910b7dde2685b177f1e7c3e3e0b4a42f7b +refs/heads/master: ae4d8c16aa22775f5731677abb8a82f03cec877e diff --git a/trunk/ipc/shm.c b/trunk/ipc/shm.c index cc63fae02f06..8d1b2c468cc4 100644 --- a/trunk/ipc/shm.c +++ b/trunk/ipc/shm.c @@ -274,8 +274,7 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma, else if (vma->vm_policy) { pol = vma->vm_policy; mpol_get(pol); /* get_vma_policy() expects this */ - } else - pol = current->mempolicy; + } return pol; } #endif diff --git a/trunk/mm/mempolicy.c b/trunk/mm/mempolicy.c index c6c61ea6bb8c..8924aaf4665c 100644 --- a/trunk/mm/mempolicy.c +++ b/trunk/mm/mempolicy.c @@ -1262,7 +1262,7 @@ asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, * @task != current]. It is the caller's responsibility to * free the reference in these cases. */ -static struct mempolicy * get_vma_policy(struct task_struct *task, +static struct mempolicy *get_vma_policy(struct task_struct *task, struct vm_area_struct *vma, unsigned long addr) { struct mempolicy *pol = task->mempolicy; @@ -1270,7 +1270,10 @@ static struct mempolicy * get_vma_policy(struct task_struct *task, if (vma) { if (vma->vm_ops && vma->vm_ops->get_policy) { - pol = vma->vm_ops->get_policy(vma, addr); + struct mempolicy *vpol = vma->vm_ops->get_policy(vma, + addr); + if (vpol) + pol = vpol; shared_pol = 1; /* if pol non-NULL, add ref below */ } else if (vma->vm_policy && vma->vm_policy->policy != MPOL_DEFAULT)