Skip to content

Commit

Permalink
[NET]: Fix potential stack overflow in net/core/utils.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Suresh Siddha authored and David S. Miller committed Aug 17, 2006
1 parent 7ea49ed commit 8557511
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/core/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8557511

Please sign in to comment.