]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: atmel-ecc - Release client on allocation failure
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 20 Feb 2026 14:03:13 +0000 (15:03 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 7 Mar 2026 05:12:20 +0000 (14:12 +0900)
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")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-ecc.c

index b6a77c8d439cc58f4f483e2257d7cd6c3232bdff..9c380351d2f9fae8329df5f95d401981ee79a49c 100644 (file)
@@ -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);
        }