Re: 2.6.0-test1 devfs question

From: Andrew Morton (akpm@osdl.org)
Date: Mon Jul 28 2003 - 02:22:16 EST


"Andrey Borzenkov" <arvidjaar@mail.ru> wrote:
>
> the bug is almost for sure in init/do_mount_devfs.c:read_dir; it
> allocates static buffer of size at most 2**MAX_ORDER and tries to
> read the whole dir at once.

Yes, that function is buggy.

diff -puN init/do_mounts_devfs.c~read_dir-fix init/do_mounts_devfs.c
--- 25/init/do_mounts_devfs.c~read_dir-fix 2003-07-28 00:21:40.000000000 -0700
+++ 25-akpm/init/do_mounts_devfs.c 2003-07-28 00:21:40.000000000 -0700
@@ -54,7 +54,7 @@ static void * __init read_dir(char *path
         if (fd < 0)
                 return NULL;
 
- for (size = 1 << 9; size <= (1 << MAX_ORDER); size <<= 1) {
+ for (size = 1 << 9; size <= (PAGE_SIZE << MAX_ORDER); size <<= 1) {
                 void *p = kmalloc(size, GFP_KERNEL);
                 int n;
                 if (!p)

_

-
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/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:34 EST