* - fix-mempolicys-check-on-a-system-with-memory-less-node.patch removed from -mm tree
@ 2007-02-21 10:45 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2007-02-21 10:45 UTC (permalink / raw)
To: kamezawa.hiroyu, ak, clameter, mm-commits
The patch titled
fix mempolicy's check on a system with memory-less-node
has been removed from the -mm tree. Its filename was
fix-mempolicys-check-on-a-system-with-memory-less-node.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
Subject: fix mempolicy's check on a system with memory-less-node
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
bind_zonelist() can create zero-length zonelist if there is a
memory-less-node. This patch checks the length of zonelist. If length is
0, returns -EINVAL.
tested on ia64/NUMA with memory-less-node.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mempolicy.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff -puN mm/mempolicy.c~fix-mempolicys-check-on-a-system-with-memory-less-node mm/mempolicy.c
--- a/mm/mempolicy.c~fix-mempolicys-check-on-a-system-with-memory-less-node
+++ a/mm/mempolicy.c
@@ -144,7 +144,7 @@ static struct zonelist *bind_zonelist(no
max++; /* space for zlcache_ptr (see mmzone.h) */
zl = kmalloc(sizeof(struct zone *) * max, GFP_KERNEL);
if (!zl)
- return NULL;
+ return ERR_PTR(-ENOMEM);
zl->zlcache_ptr = NULL;
num = 0;
/* First put in the highest zones from all nodes, then all the next
@@ -162,6 +162,10 @@ static struct zonelist *bind_zonelist(no
break;
k--;
}
+ if (num == 0) {
+ kfree(zl);
+ return ERR_PTR(-EINVAL);
+ }
zl->zones[num] = NULL;
return zl;
}
@@ -193,9 +197,10 @@ static struct mempolicy *mpol_new(int mo
break;
case MPOL_BIND:
policy->v.zonelist = bind_zonelist(nodes);
- if (policy->v.zonelist == NULL) {
+ if (IS_ERR(policy->v.zonelist)) {
+ void *error_code = policy->v.zonelist;
kmem_cache_free(policy_cache, policy);
- return ERR_PTR(-ENOMEM);
+ return error_code;
}
break;
}
@@ -1667,7 +1672,7 @@ void mpol_rebind_policy(struct mempolicy
* then zonelist_policy() will "FALL THROUGH" to MPOL_DEFAULT.
*/
- if (zonelist) {
+ if (!IS_ERR(zonelist)) {
/* Good - got mem - substitute new zonelist */
kfree(pol->v.zonelist);
pol->v.zonelist = zonelist;
_
Patches currently in -mm which might be from kamezawa.hiroyu@jp.fujitsu.com are
mm-only-sched-add-a-few-scheduler-event-counters.patch
reiser4-hardirq-include-fix.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-21 10:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 10:45 - fix-mempolicys-check-on-a-system-with-memory-less-node.patch removed from -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.