aboutsummaryrefslogtreecommitdiffstats
path: root/lib/random32.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
commit4cac04dd63fa3b202ee313ed1afbbd135ab887ee (patch)
tree8fa7ed0186030297c69ac95530853eb5c860a894 /lib/random32.c
parente1c287b992d30dab86f1b1bfe1780d9d3a652b34 (diff)
parentbfe87dbc7b4da5b05a1a78480e996787a500cc6f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: fix endian lossage in forcedeth net/tokenring/olympic.c section fixes net: marvell.c fix sparse shadowed variable warning [VLAN]: Fix egress priority mappings leak. [TG3]: Add PHY workaround for 5784 [NET]: srandom32 fixes for networking v2 [IPV6]: Fix refcounting for anycast dst entries. [IPV6]: inet6_dev on loopback should be kept until namespace stop. [IPV6]: Event type in addrconf_ifdown is mis-used. [ICMP]: Ensure that ICMP relookup maintains status quo
Diffstat (limited to 'lib/random32.c')
-rw-r--r--lib/random32.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/random32.c b/lib/random32.c
index ec7f81d3fb18..ca87d86992bd 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32);
97 * @seed: seed value 97 * @seed: seed value
98 * 98 *
99 * Add some additional seeding to the random32() pool. 99 * Add some additional seeding to the random32() pool.
100 * Note: this pool is per cpu so it only affects current CPU.
101 */ 100 */
102void srandom32(u32 entropy) 101void srandom32(u32 entropy)
103{ 102{
104 struct rnd_state *state = &get_cpu_var(net_rand_state); 103 int i;
105 __set_random32(state, state->s1 ^ entropy); 104 /*
106 put_cpu_var(state); 105 * No locking on the CPUs, but then somewhat random results are, well,
106 * expected.
107 */
108 for_each_possible_cpu (i) {
109 struct rnd_state *state = &per_cpu(net_rand_state, i);
110 __set_random32(state, state->s1 ^ entropy);
111 }
107} 112}
108EXPORT_SYMBOL(srandom32); 113EXPORT_SYMBOL(srandom32);
109 114