]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwrng: core - Clean up RNG list when last hwrng is unregistered
authorGary R Hook <gary.hook@amd.com>
Fri, 15 Dec 2017 19:55:59 +0000 (13:55 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Mar 2018 10:02:52 +0000 (11:02 +0100)
commite36bb4076f37671e3392c04bd83de8e8f715055f
tree0a992b84a44a48c4b1d346499960e26d86c1fb75
parent233f5fee86c377b1002f6aee07c3ace256fa6844
hwrng: core - Clean up RNG list when last hwrng is unregistered

[ Upstream commit 0e4b52942b1c76f89e0dcb829f72e123d0678f54 ]

Commit 142a27f0a731 added support for a "best" RNG, and in doing so
introduced a hang from rmmod/modprobe -r when the last RNG on the list
was unloaded.

When the hwrng list is depleted, return the global variables to their
original state and decrement all references to the object.

Fixes: 142a27f0a731 ("hwrng: core - Reset user selected rng by writing "" to rng_current")
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Reviewed-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/hw_random/core.c