aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ipc/shm.c3
-rw-r--r--mm/mempolicy.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index cc63fae02f0..8d1b2c468cc 100644
--- a/ipc/shm.c
+++ b/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/mm/mempolicy.c b/mm/mempolicy.c
index c6c61ea6bb8..8924aaf4665 100644
--- a/mm/mempolicy.c
+++ b/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)