[NET]: Fix potential stack overflow in net/core/utils.c
authorSuresh Siddha <suresh.b.siddha@intel.com>
Tue, 15 Aug 2006 07:03:01 +0000 (00:03 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 17 Aug 2006 23:29:47 +0000 (16:29 -0700)
On High end systems (1024 or so cpus) this can potentially cause stack
overflow.  Fix the stack usage.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/utils.c

index 4f96f389243d7d6322288609f6477c74eab5ac09..e31c90e055941e73f020e07adcd92360e81960da 100644 (file)
@@ -130,12 +130,13 @@ void __init net_random_init(void)
 static int net_random_reseed(void)
 {
        int i;
-       unsigned long seed[NR_CPUS];
+       unsigned long seed;
 
-       get_random_bytes(seed, sizeof(seed));
        for_each_possible_cpu(i) {
                struct nrnd_state *state = &per_cpu(net_rand_state,i);
-               __net_srandom(state, seed[i]);
+
+               get_random_bytes(&seed, sizeof(seed));
+               __net_srandom(state, seed);
        }
        return 0;
 }