diff options
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index bec88c81244e..72f402cc9c9a 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -161,6 +161,10 @@ static struct mempolicy *mpol_new(int mode, nodemask_t *nodes) | |||
161 | switch (mode) { | 161 | switch (mode) { |
162 | case MPOL_INTERLEAVE: | 162 | case MPOL_INTERLEAVE: |
163 | policy->v.nodes = *nodes; | 163 | policy->v.nodes = *nodes; |
164 | if (nodes_weight(*nodes) == 0) { | ||
165 | kmem_cache_free(policy_cache, policy); | ||
166 | return ERR_PTR(-EINVAL); | ||
167 | } | ||
164 | break; | 168 | break; |
165 | case MPOL_PREFERRED: | 169 | case MPOL_PREFERRED: |
166 | policy->v.preferred_node = first_node(*nodes); | 170 | policy->v.preferred_node = first_node(*nodes); |