Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85575112 authored by Suresh Siddha's avatar Suresh Siddha Committed by David S. Miller
Browse files

[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: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7ea49ed7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;
}