* Bug fix in slab.c:alloc_arraycache
@ 2005-03-09 3:13 Chen, Kenneth W
0 siblings, 0 replies; only message in thread
From: Chen, Kenneth W @ 2005-03-09 3:13 UTC (permalink / raw)
To: linux-kernel; +Cc: 'Andrew Morton'
Kmem_cache_alloc_node is not capable of handling a null cachep
pointer as its input argument.
If I try to increase a slab limit by echoing a very large number
into /proc/slabinfo, kernel will panic from alloc_arraycache()
because Kmem_find_general_cachep() can actually return a NULL
pointer if the size argument is sufficiently large.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
--- linux-2.6.11/mm/slab.c Mon Oct 18 14:55:43 2004
+++ linux-2.6.11.ken/mm/slab.c Tue Mar 1 19:14:07 2005
@@ -643,8 +645,10 @@
struct array_cache *nc = NULL;
if (cpu != -1) {
- nc = kmem_cache_alloc_node(kmem_find_general_cachep(memsize,
- GFP_KERNEL), cpu_to_node(cpu));
+ kmem_cache_t * cachep;
+ cachep = kmem_find_general_cachep(memsize, GFP_KERNEL);
+ if (cachep)
+ nc = kmem_cache_alloc_node(cachep, cpu_to_node(cpu));
}
if (!nc)
nc = kmalloc(memsize, GFP_KERNEL);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-09 3:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 3:13 Bug fix in slab.c:alloc_arraycache Chen, Kenneth W
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®