Skip to contentSkip to conversation

crypto: atmel-ecc - Release client on allocation failure

PATCH In review Thorsten Blum 2 participants 2 messages Feb 20 – Mar 7

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: atmel-ecc - Release client on allocation failure

Call atmel_ecc_i2c_client_free() to release the I2C client reserved by atmel_ecc_i2c_client_alloc() when crypto_alloc_kpp() fails. Otherwise ->tfm_count will be out of sync.

Fixes 11105693fa05 ("crypto: atmel-ecc - introduce Microchip / Atmel ECC driver")

---
Compile-tested only.

---
 drivers/crypto/atmel-ecc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/crypto/atmel-ecc.c +1 -0
index 0d48e64d28b1..9da5a0388080 100644
@@ -261,6 +261,7 @@ static int atmel_ecdh_init_tfm(struct crypto_kpp *tfm)
 	if (IS_ERR(fallback)) {
 		dev_err(&ctx->client->dev, "Failed to allocate transformation for '%s': %ld\n",
 			alg, PTR_ERR(fallback));
+		atmel_ecc_i2c_client_free(ctx->client);
 		return PTR_ERR(fallback);
 	}
 
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
maintainer
#1 lore raw
Quoted 4 lines · Thorsten Blum

Call atmel_ecc_i2c_client_free() to release the I2C client reserved by atmel_ecc_i2c_client_alloc() when crypto_alloc_kpp() fails. Otherwise ->tfm_count will be out of sync.

Quoted 8 lines
Fixes 11105693fa05 ("crypto: atmel-ecc - introduce Microchip / Atmel ECC driver")

---
Compile-tested only.

---
 drivers/crypto/atmel-ecc.c | 1 +
 1 file changed, 1 insertion(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt