* [PATCH] crypto: atmel-sha204a - Fix OOM ->tfm_count leak
@ 2026-02-18 23:54 Thorsten Blum
2026-02-28 8:56 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-02-18 23:54 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Linus Walleij, Ard Biesheuvel
Cc: Thorsten Blum, stable, linux-crypto, linux-arm-kernel,
linux-kernel
If memory allocation fails, decrement ->tfm_count to avoid blocking
future reads.
Cc: stable@vger.kernel.org
Fixes: da001fb651b0 ("crypto: atmel-i2c - add support for SHA204A random number generator")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/crypto/atmel-sha204a.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c
index 2081a4d538d0..63633d2b8763 100644
--- a/drivers/crypto/atmel-sha204a.c
+++ b/drivers/crypto/atmel-sha204a.c
@@ -53,9 +53,10 @@ static int atmel_sha204a_rng_read_nonblocking(struct hwrng *rng, void *data,
rng->priv = 0;
} else {
work_data = kmalloc(sizeof(*work_data), GFP_ATOMIC);
- if (!work_data)
+ if (!work_data) {
+ atomic_dec(&i2c_priv->tfm_count);
return -ENOMEM;
-
+ }
work_data->ctx = i2c_priv;
work_data->client = i2c_priv->client;
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: atmel-sha204a - Fix OOM ->tfm_count leak
2026-02-18 23:54 [PATCH] crypto: atmel-sha204a - Fix OOM ->tfm_count leak Thorsten Blum
@ 2026-02-28 8:56 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-02-28 8:56 UTC (permalink / raw)
To: Thorsten Blum
Cc: David S. Miller, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Linus Walleij, Ard Biesheuvel, stable, linux-crypto,
linux-arm-kernel, linux-kernel
On Thu, Feb 19, 2026 at 12:54:00AM +0100, Thorsten Blum wrote:
> If memory allocation fails, decrement ->tfm_count to avoid blocking
> future reads.
>
> Cc: stable@vger.kernel.org
> Fixes: da001fb651b0 ("crypto: atmel-i2c - add support for SHA204A random number generator")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/crypto/atmel-sha204a.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-28 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 23:54 [PATCH] crypto: atmel-sha204a - Fix OOM ->tfm_count leak Thorsten Blum
2026-02-28 8:56 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox