From 4487cfa1fa5302a14e7001265b1fe46cf701933b Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Thu, 19 Jul 2018 10:05:56 +0100 Subject: [PATCH] crypto/virtio: fix memory leak Put session private data back to mempool when clearing a crypto session, which is expected to be done in the PMD. Fixes: b7fa78c7d3b0 ("crypto/virtio: support session related ops") Cc: stable@dpdk.org Signed-off-by: Pablo de Lara Reviewed-by: Jay Zhou --- drivers/crypto/virtio/virtio_cryptodev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c index cc7a0b1013..568b5a406c 100644 --- a/drivers/crypto/virtio/virtio_cryptodev.c +++ b/drivers/crypto/virtio/virtio_cryptodev.c @@ -1076,7 +1076,10 @@ virtio_crypto_sym_clear_session( VIRTIO_CRYPTO_SESSION_LOG_INFO("Close session %"PRIu64" successfully ", session->session_id); - memset(sess, 0, sizeof(struct virtio_crypto_session)); + memset(session, 0, sizeof(struct virtio_crypto_session)); + struct rte_mempool *sess_mp = rte_mempool_from_obj(session); + set_sym_session_private_data(sess, cryptodev_virtio_driver_id, NULL); + rte_mempool_put(sess_mp, session); rte_free(malloc_virt_addr); } -- 2.20.1