From: zhenwei pi <pizhenwei@bytedance.com>
To: Wei Yongjun <weiyongjun@huaweicloud.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Gonglei <arei.gonglei@huawei.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
virtualization@lists.linux-foundation.org,
linux-crypto@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session()
Date: Tue, 15 Nov 2022 09:09:43 +0800 [thread overview]
Message-ID: <0cc9f344-44ff-284f-391e-dcf756d74471@bytedance.com> (raw)
In-Reply-To: <20221114110740.537276-1-weiyongjun@huaweicloud.com>
Looks good to me, thanks!
Acked-by: zhenwei pi<pizhenwei@bytedance.com>
On 11/14/22 19:07, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> 'vc_ctrl_req' is alloced in virtio_crypto_alg_skcipher_close_session(),
> and should be freed in the invalid ctrl_status->status error handling
> case. Otherwise there is a memory leak.
>
> Fixes: 0756ad15b1fe ("virtio-crypto: use private buffer for control request")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/crypto/virtio/virtio_crypto_skcipher_algs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
> index e553ccadbcbc..e5876286828b 100644
> --- a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
> +++ b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
> @@ -239,7 +239,8 @@ static int virtio_crypto_alg_skcipher_close_session(
> pr_err("virtio_crypto: Close session failed status: %u, session_id: 0x%llx\n",
> ctrl_status->status, destroy_session->session_id);
>
> - return -EINVAL;
> + err = -EINVAL;
> + goto out;
> }
>
> err = 0;
--
zhenwei pi
next prev parent reply other threads:[~2022-11-15 1:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 11:07 [PATCH] virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session() Wei Yongjun
2022-11-14 11:18 ` Gonglei (Arei)
2022-11-15 1:09 ` zhenwei pi [this message]
2022-11-15 6:27 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cc9f344-44ff-284f-391e-dcf756d74471@bytedance.com \
--to=pizhenwei@bytedance.com \
--cc=arei.gonglei@huawei.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jasowang@redhat.com \
--cc=linux-crypto@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=weiyongjun1@huawei.com \
--cc=weiyongjun@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox