WTF: patch "[PATCH] crypto: qat - fix memory leak in RSA" was seriously submitted to be applied to the 5.18-stable tree?
Subsystems (2)
[email protected]
maintainerThe patch below was submitted to be applied to the 5.18-stable tree.
I fail to see how this patch meets the stable kernel rules as found at Documentation/process/stable-kernel-rules.rst.
I could be totally wrong, and if so, please respond to <[email protected]> and let me know why this patch should be applied. Otherwise, it is now dropped from my patch queues, never to be seen again.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 80a52e1ee7757b742f96bfb0d58f0c14eb6583d0 Mon Sep 17 00:00:00 2001
From: Giovanni Cabiddu <[email protected]>
Date: Mon, 9 May 2022 14:34:11 +0100
Subject: [PATCH] crypto: qat - fix memory leak in RSA
When an RSA key represented in form 2 (as defined in PKCS #1 V2.1) is used, some components of the private key persist even after the TFM is released.
Replace the explicit calls to free the buffers in qat_rsa_exit_tfm() with a call to qat_rsa_clear_ctx() which frees all buffers referenced in the TFM context.
drivers/crypto/qat/qat_common/qat_asym_algs.c +1 -11
@@ -1257,18 +1257,8 @@ static void qat_rsa_exit_tfm(struct crypto_akcipher *tfm)struct qat_rsa_ctx *ctx =akcipher_tfm_ctx (tfm);struct device *dev = &GET_DEV (ctx->inst->accel_dev); -if (ctx->n) -dma_free_coherent (dev, ctx->key_sz, ctx->n, ctx->dma_n); -if (ctx->e) -dma_free_coherent (dev, ctx->key_sz, ctx->e, ctx->dma_e); -if (ctx->d) { -memset (ctx->d,'\0' , ctx->key_sz); -dma_free_coherent (dev, ctx->key_sz, ctx->d, ctx->dma_d); - } +qat_rsa_clear_ctx (dev, ctx);qat_crypto_put_instance (ctx->inst); - ctx->n =NULL ; - ctx->e =NULL ; - ctx->d =NULL ; }static struct akcipher_alg rsa = {