diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 981a07f5967e5d2c63a8cfc9a833e458635ac460..4affc6e455113344e8eaf8c75449ef8f0f614e27 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2846,7 +2846,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) switch (mode) { case MPOL_PREFERRED: /* - * Insist on a nodelist of one node only + * Insist on a nodelist of one node only, although later + * we use first_node(nodes) to grab a single node, so here + * nodelist (or nodes) cannot be empty. */ if (nodelist) { char *rest = nodelist; @@ -2854,6 +2856,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) rest++; if (*rest) goto out; + if (nodes_empty(nodes)) + goto out; } break; case MPOL_INTERLEAVE: