kmalloc_sizes.h breakage

David Mosberger (davidm@napali.hpl.hp.com)
Tue, 8 Apr 2003 22:58:22 -0700


Someone forgot that the cache_sizes array needs to be NULL terminated.
This, combined with the NFSD 64-bit binary compatibility breakage
caused instant kernel death because kmalloc() (via NFSD) would attempt
to alloc a huge chunk of memory and run past the end of the
cache_sizes array. In other words, a fun evening chasing down bugs.
Not.

(The patch also gets rid of some trailing whitespace, in case you
wonder about those "invisible" changes.)

--david

===== mm/slab.c 1.73 vs edited =====
--- 1.73/mm/slab.c Thu Mar 27 21:16:47 2003
+++ edited/mm/slab.c Tue Apr 8 17:52:44 2003
@@ -387,14 +387,15 @@
};

/* Must match cache_sizes above. Out of line to keep cache footprint low. */
-static struct {
- char *name;
+static struct {
+ char *name;
char *name_dma;
-} cache_names[] = {
+} cache_names[] = {
#define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
#include <linux/kmalloc_sizes.h>
+ { 0, }
#undef CACHE
-};
+};

struct arraycache_init initarray_cache __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
struct arraycache_init initarray_generic __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/