From: Herbert Xu <herbert@gondor.apana.org.au>
To: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Stephan Müller" <smueller@chronox.de>
Subject: Re: [PATCH] crypto: drbg - convert to guard(mutex)
Date: Sat, 28 Feb 2026 12:20:46 +0900 [thread overview]
Message-ID: <aaJfDsCLKfy34dSP@gondor.apana.org.au> (raw)
In-Reply-To: <20260207232925.80976-1-rajveer.chaudhari.linux@gmail.com>
On Sun, Feb 08, 2026 at 04:59:25AM +0530, Rajveer Chaudhari wrote:
> Replaced old manual mutex locking/unlocking with
> new safe guard(mutex) in drbg_instantiate().
> This ensures mutex gets unlocked on every return and prevents deadlocks.
>
> Signed-off-by: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>
> ---
> crypto/drbg.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index 1d433dae9955..d52a7bd07322 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -103,6 +103,7 @@
> #include <linux/kernel.h>
> #include <linux/jiffies.h>
> #include <linux/string_choices.h>
> +#include <linux/cleanup.h>
Please keep the headers sorted alphabetically.
> free_everything:
> - mutex_unlock(&drbg->drbg_mutex);
> drbg_uninstantiate(drbg);
> return ret;
This is a subtle change and now drbg_uninstantiate will be called
within the critical section. Are you sure this is safe?
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2026-02-28 3:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 23:29 Rajveer Chaudhari
2026-02-28 3:20 ` Herbert Xu [this message]
2026-03-01 11:46 ` Rajveer Chaudhari
2026-03-02 12:24 ` Herbert Xu
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=aaJfDsCLKfy34dSP@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rajveer.chaudhari.linux@gmail.com \
--cc=smueller@chronox.de \
/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
all inboxes | Powered by JetHome®