Fix a boot failure on systems with non-contiguous NUMA id's.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJXmhmRAAoJEPL5WVaVDYGjOIcH/ixqzAvUqiquF+5EWVvaBtgU
 xZvJ+ryaqifQKfK1GeC7394O7lb8zDA/Z3VvERPwmsHpwqpsoFE+V/cmH8gKc4/A
 yLuhEG24GFFwSpAidHNBKR3SaIYvnfDIpq05JId95Yq4AGNzaMapYhMY9kjGzvyY
 /SMN7v50nl62aMo9mikequjxRHqUPamr1cP2aRjUZ7RqD4uruDwIup75hS+uS/gb
 DWnAeqnVj0A+5EhKVkFpf5H8KP1L/ob4oghrnxL4lLyr+tuh67LVFXV3Fv4xL5Z+
 Bnbqqh8Y70GfpSBYrfDMZlZ1cgauXZe+sDd+Q09uEfCA8ctFE6wkXCKzVGrRTuY=
 =DN2X
 -----END PGP SIGNATURE-----

Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random

Pull random driver fix from Ted Ts'o:
 "Fix a boot failure on systems with non-contiguous NUMA id's"

* tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
  random: use for_each_online_node() to iterate over NUMA nodes
This commit is contained in:
Linus Torvalds 2016-07-28 13:46:25 -07:00
commit 71e9dcc001
1 changed files with 1 additions and 2 deletions

View File

@ -1668,13 +1668,12 @@ static int rand_initialize(void)
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
pool = kmalloc(num_nodes * sizeof(void *), pool = kmalloc(num_nodes * sizeof(void *),
GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO); GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO);
for (i=0; i < num_nodes; i++) { for_each_online_node(i) {
crng = kmalloc_node(sizeof(struct crng_state), crng = kmalloc_node(sizeof(struct crng_state),
GFP_KERNEL | __GFP_NOFAIL, i); GFP_KERNEL | __GFP_NOFAIL, i);
spin_lock_init(&crng->lock); spin_lock_init(&crng->lock);
crng_initialize(crng); crng_initialize(crng);
pool[i] = crng; pool[i] = crng;
} }
mb(); mb();
crng_node_pool = pool; crng_node_pool = pool;