Re: [PATCH 2/5] hwrng: core - Fix current_rng init/cleanup race yet again

2014-12-25 Thread Herbert Xu
On Wed, Dec 24, 2014 at 09:56:36AM +1030, Rusty Russell wrote: > > I'll have to pull the tree to review it properly, but the theory was > that the reference count was counting users of the rng. Now I don't > know what it's counting: The reference count starts off at zero, meaning that the RNG has

Re: [PATCH 2/5] hwrng: core - Fix current_rng init/cleanup race yet again

2014-12-25 Thread Rusty Russell
Herbert Xu writes: > 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 This patch scares me a li

[PATCH 2/5] hwrng: core - Fix current_rng init/cleanup race yet again

2014-12-22 Thread Herbert Xu
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 --- drivers/char/hw_random/core.c | 14 +++---