hwrng: core - Fix current_rng init/cleanup race yet again
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 23 Dec 2014 05:40:18 +0000 (16:40 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 25 Dec 2014 21:33:34 +0000 (08:33 +1100)
commit15b66cd54291186011f733cc750263f320b8a0a4
tree3b95b884c9381f5fb6a7ea4286df2288d61ba4ac
parent77584ee57434813b50fc85cde995a6271a5081b7
hwrng: core - Fix current_rng init/cleanup race yet again

The kref solution is still buggy because we were only focusing
on the register/unregister race.  The same race affects the
setting of current_rng through sysfs.

This patch fixes it by using kref_get_unless_zero.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c