summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2008-07-04 12:24:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-04 13:03:05 -0700
commitd79df630f622806c4d0e116fbaf6ebf6baf53461 (patch)
treed5a1c06209210c84ec60099687e4a87723ae1599
parentb8a0b6ccf2ba2519ace65d782b41ee91bf3c3778 (diff)
downloadlinux-3.10-d79df630f622806c4d0e116fbaf6ebf6baf53461.tar.gz
linux-3.10-d79df630f622806c4d0e116fbaf6ebf6baf53461.tar.bz2
linux-3.10-d79df630f622806c4d0e116fbaf6ebf6baf53461.zip
mempolicy: mask off internal flags for userspace API
Flags considered internal to the mempolicy kernel code are stored as part of the "flags" member of struct mempolicy. Before exposing a policy type to userspace via get_mempolicy(), these internal flags must be masked. Flags exposed to userspace, however, should still be returned to the user. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/mempolicy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index a37a5034f63..c94e58b192c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -729,7 +729,11 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
} else {
*policy = pol == &default_policy ? MPOL_DEFAULT :
pol->mode;
- *policy |= pol->flags;
+ /*
+ * Internal mempolicy flags must be masked off before exposing
+ * the policy to userspace.
+ */
+ *policy |= (pol->flags & MPOL_MODE_FLAGS);
}
if (vma) {