mirror of
https://github.com/torvalds/linux.git
synced 2026-03-07 23:04:33 +01:00
crypto: atmel-sha204a - Fix OOM ->tfm_count leak
If memory allocation fails, decrement ->tfm_count to avoid blocking
future reads.
Cc: stable@vger.kernel.org
Fixes: da001fb651 ("crypto: atmel-i2c - add support for SHA204A random number generator")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
889b0e2721
commit
d240b079a3
1 changed files with 3 additions and 2 deletions
|
|
@ -52,9 +52,10 @@ static int atmel_sha204a_rng_read_nonblocking(struct hwrng *rng, void *data,
|
|||
rng->priv = 0;
|
||||
} else {
|
||||
work_data = kmalloc_obj(*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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue