From: Eric Biggers <ebiggers@kernel.org>
To: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: jitterentropy: Fix debugfs leak on register failure
Date: Sun, 25 Oct 2026 14:21:55 -0700 [thread overview]
Message-ID: <20261025212155.GA4509@quark> (raw)
In-Reply-To: <20261025031835.2354-1-tangbin@cmss.chinamobile.com>
On Sun, Oct 25, 2026 at 11:18:35AM +0800, Tang Bin wrote:
> jent_mod_init() calls jent_testing_init() to create debugfs entries, but on
> success of jent_entropy_init() it returns crypto_register_rng() directly.
> If registration fails the module does not load so jent_mod_exit() never
> runs, leaking the debugfs entries. Capture the return, call
> jent_testing_exit() on failure before returning.
>
> Fixes: dfc9fa91938b ("crypto: jitterentropy - avoid compiler warnings")
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> crypto/jitterentropy-kcapi.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
> index 652852649..43a0694e6 100644
> --- a/crypto/jitterentropy-kcapi.c
> +++ b/crypto/jitterentropy-kcapi.c
> @@ -296,7 +296,10 @@ static int __init jent_mod_init(void)
> pr_info("jitterentropy: Initialization failed with host not compliant with requirements: %d\n", ret);
> return -EFAULT;
> }
> - return crypto_register_rng(&jent_alg);
> + ret = crypto_register_rng(&jent_alg);
> + if (ret)
> + jent_testing_exit();
> + return ret;
The call to crypto_register_rng() is already being removed by
https://lore.kernel.org/linux-crypto/20261018204618.104876-12-ebiggers@kernel.org/
- Eric
prev parent reply other threads:[~2026-10-25 21:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 3:18 [PATCH] crypto: jitterentropy: Fix debugfs leak on register failure Tang Bin
2026-10-25 21:21 ` Eric Biggers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261025212155.GA4509@quark \
--to=ebiggers@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox