Skip to contentSkip to conversation

fix potential stack overflow in net/core/utils.c

PATCH New Siddha, Suresh B 1 participant 1 message Aug 4, 2006 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

net/core/utils.c renamed from net/core/utils.c~ +4 -3
@@ -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;
 }