From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:51648 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754859AbeCVNHT (ORCPT ); Thu, 22 Mar 2018 09:07:19 -0400 Subject: Patch "hwrng: core - Clean up RNG list when last hwrng is unregistered" has been added to the 4.15-stable tree To: gary.hook@amd.com, alexander.levin@microsoft.com, gregkh@linuxfoundation.org, herbert@gondor.apana.org.au, prasannatsmkumar@gmail.com Cc: , From: Date: Thu, 22 Mar 2018 14:06:51 +0100 Message-ID: <1521724011205233@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled hwrng: core - Clean up RNG list when last hwrng is unregistered to the 4.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: hwrng-core-clean-up-rng-list-when-last-hwrng-is-unregistered.patch and it can be found in the queue-4.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Thu Mar 22 14:03:40 CET 2018 From: Gary R Hook Date: Fri, 15 Dec 2017 13:55:59 -0600 Subject: hwrng: core - Clean up RNG list when last hwrng is unregistered From: Gary R Hook [ 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 Reviewed-by: PrasannaKumar Muralidharan Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -306,6 +306,10 @@ static int enable_best_rng(void) ret = ((new_rng == current_rng) ? 0 : set_current_rng(new_rng)); if (!ret) cur_rng_set_by_user = 0; + } else { + drop_current_rng(); + cur_rng_set_by_user = 0; + ret = 0; } return ret; Patches currently in stable-queue which might be from gary.hook@amd.com are queue-4.15/hwrng-core-clean-up-rng-list-when-last-hwrng-is-unregistered.patch