lkml.org 
[lkml]   [2022]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectPING: [PATCH v2] virtio-crypto: fix memory-leak
From
On 2022/8/16 下午5:43, Lei He wrote:
> From: lei he <helei.sig11@bytedance.com>
>
> Fix memory-leak for virtio-crypto akcipher request, this problem is
> introduced by 59ca6c93387d3(virtio-crypto: implement RSA algorithm).
> The leak can be reproduced and tested with the following script
> inside virtual machine:
>
> Signed-off-by: lei he <helei.sig11@bytedance.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Gonglei <arei.gonglei@huawei.com>
> ---
> drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
> index 2a60d0525cde..168195672e2e 100644
> --- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
> +++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
> @@ -56,6 +56,10 @@ static void virtio_crypto_akcipher_finalize_req(
> struct virtio_crypto_akcipher_request *vc_akcipher_req,
> struct akcipher_request *req, int err)
> {
> + kfree(vc_akcipher_req->src_buf);
> + kfree(vc_akcipher_req->dst_buf);
> + vc_akcipher_req->src_buf = NULL;
> + vc_akcipher_req->dst_buf = NULL;
> virtcrypto_clear_request(&vc_akcipher_req->base);
>
> crypto_finalize_akcipher_request(vc_akcipher_req->base.dataq->engine, req, err);
>
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

PING.

Best regards,
Lei He
--
helei.sig11@bytedance.com

\
 
 \ /
  Last update: 2022-08-24 10:39    [W:0.226 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site