* [PATCH] crypto: chcr - Free fallback transforms when device assignment fails
@ 2026-11-03 6:38 Wentao Liang
2026-11-03 7:27 ` Krzysztof Kozlowski
2026-11-13 13:05 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03 6:38 UTC (permalink / raw)
To: ayush.sawal, herbert
Cc: davem, linux-crypto, linux-kernel, Wentao Liang, stable
The skcipher, RFC3686 and AEAD initialization callbacks allocate their
fallback transforms before calling chcr_device_init(). If no active
device can be assigned, chcr_device_init() returns -ENXIO and the
fallback is leaked. The crypto core does not invoke the algorithm's
exit callback after its initialization callback fails.
Free the fallback transform before returning the device assignment
error in each of these initialization callbacks.
Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
Fixes: 0e93708dabc0 ("crypto: chcr - Add fallback for AEAD algos")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/crypto/chelsio/chcr_algo.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index e2f2b2a6200e..fd4720fa50a9 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -1439,6 +1439,7 @@ static int chcr_init_tfm(struct crypto_skcipher *tfm)
struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
struct chcr_context *ctx = crypto_skcipher_ctx(tfm);
struct ablk_ctx *ablkctx = ABLK_CTX(ctx);
+ int ret;
ablkctx->sw_cipher = crypto_alloc_skcipher(alg->base.cra_name, 0,
CRYPTO_ALG_NEED_FALLBACK);
@@ -1450,7 +1451,11 @@ static int chcr_init_tfm(struct crypto_skcipher *tfm)
crypto_skcipher_set_reqsize(tfm, sizeof(struct chcr_skcipher_req_ctx) +
crypto_skcipher_reqsize(ablkctx->sw_cipher));
- return chcr_device_init(ctx);
+ ret = chcr_device_init(ctx);
+ if (ret)
+ crypto_free_skcipher(ablkctx->sw_cipher);
+
+ return ret;
}
static int chcr_rfc3686_init(struct crypto_skcipher *tfm)
@@ -1458,6 +1463,7 @@ static int chcr_rfc3686_init(struct crypto_skcipher *tfm)
struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
struct chcr_context *ctx = crypto_skcipher_ctx(tfm);
struct ablk_ctx *ablkctx = ABLK_CTX(ctx);
+ int ret;
/*RFC3686 initialises IV counter value to 1, rfc3686(ctr(aes))
* cannot be used as fallback in chcr_handle_cipher_response
@@ -1470,7 +1476,11 @@ static int chcr_rfc3686_init(struct crypto_skcipher *tfm)
}
crypto_skcipher_set_reqsize(tfm, sizeof(struct chcr_skcipher_req_ctx) +
crypto_skcipher_reqsize(ablkctx->sw_cipher));
- return chcr_device_init(ctx);
+ ret = chcr_device_init(ctx);
+ if (ret)
+ crypto_free_skcipher(ablkctx->sw_cipher);
+
+ return ret;
}
@@ -3164,6 +3174,7 @@ static int chcr_aead_cra_init(struct crypto_aead *tfm)
{
struct chcr_aead_ctx *aeadctx = AEAD_CTX(a_ctx(tfm));
struct aead_alg *alg = crypto_aead_alg(tfm);
+ int ret;
aeadctx->sw_cipher = crypto_alloc_aead(alg->base.cra_name, 0,
CRYPTO_ALG_NEED_FALLBACK |
@@ -3174,7 +3185,11 @@ static int chcr_aead_cra_init(struct crypto_aead *tfm)
tfm, max(sizeof(struct chcr_aead_reqctx),
sizeof(struct aead_request) +
crypto_aead_reqsize(aeadctx->sw_cipher)));
- return chcr_device_init(a_ctx(tfm));
+ ret = chcr_device_init(a_ctx(tfm));
+ if (ret)
+ crypto_free_aead(aeadctx->sw_cipher);
+
+ return ret;
}
static void chcr_aead_cra_exit(struct crypto_aead *tfm)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: chcr - Free fallback transforms when device assignment fails
2026-11-03 6:38 [PATCH] crypto: chcr - Free fallback transforms when device assignment fails Wentao Liang
@ 2026-11-03 7:27 ` Krzysztof Kozlowski
2026-11-13 13:05 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 7:27 UTC (permalink / raw)
To: Wentao Liang
Cc: herbert, linux-crypto, davem, linux-kernel, ayush.sawal, stable
On Tue, 03 Nov 2026 06:38:50 +0000, Wentao Liang wrote:
> The skcipher, RFC3686 and AEAD initialization callbacks allocate their
> fallback transforms before calling chcr_device_init(). If no active
> device can be assigned, chcr_device_init() returns -ENXIO and the
> fallback is leaked. The crypto core does not invoke the algorithm's
> exit callback after its initialization callback fails.
>
> Free the fallback transform before returning the device assignment
> error in each of these initialization callbacks.
>
> Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
> Fixes: 0e93708dabc0 ("crypto: chcr - Add fallback for AEAD algos")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/crypto/chelsio/chcr_algo.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email, thus I doubt
that we speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document usage of LLM and what you should not do
if this was posted in a good faith.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: chcr - Free fallback transforms when device assignment fails
2026-11-03 6:38 [PATCH] crypto: chcr - Free fallback transforms when device assignment fails Wentao Liang
2026-11-03 7:27 ` Krzysztof Kozlowski
@ 2026-11-13 13:05 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2026-11-13 13:05 UTC (permalink / raw)
To: Wentao Liang; +Cc: ayush.sawal, davem, linux-crypto, linux-kernel, stable
On Tue, Nov 03, 2026 at 06:38:50AM +0000, Wentao Liang wrote:
> The skcipher, RFC3686 and AEAD initialization callbacks allocate their
> fallback transforms before calling chcr_device_init(). If no active
> device can be assigned, chcr_device_init() returns -ENXIO and the
> fallback is leaked. The crypto core does not invoke the algorithm's
> exit callback after its initialization callback fails.
>
> Free the fallback transform before returning the device assignment
> error in each of these initialization callbacks.
>
> Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
> Fixes: 0e93708dabc0 ("crypto: chcr - Add fallback for AEAD algos")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/crypto/chelsio/chcr_algo.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 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] 3+ messages in thread
end of thread, other threads:[~2026-11-13 13:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 6:38 [PATCH] crypto: chcr - Free fallback transforms when device assignment fails Wentao Liang
2026-11-03 7:27 ` Krzysztof Kozlowski
2026-11-13 13:05 ` Herbert Xu
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®