From: Suresh Siddha Date: Tue, 15 Aug 2006 07:03:01 +0000 (-0700) Subject: [NET]: Fix potential stack overflow in net/core/utils.c X-Git-Tag: v2.6.18-rc5~76^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=855751125093f758871b70da2951d8b92b6368cc;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [NET]: Fix potential stack overflow in net/core/utils.c On High end systems (1024 or so cpus) this can potentially cause stack overflow. Fix the stack usage. Signed-off-by: Suresh Siddha Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/net/core/utils.c b/net/core/utils.c index 4f96f38..e31c90e 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -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; }