From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 136B95920; Thu, 19 Jul 2018 19:12:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 10:12:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,375,1526367600"; d="scan'208";a="72761566" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by fmsmga004.fm.intel.com with ESMTP; 19 Jul 2018 10:12:05 -0700 From: Pablo de Lara To: jianjay.zhou@huawei.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Date: Thu, 19 Jul 2018 10:05:56 +0100 Message-Id: <20180719090556.30495-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.14.4 Subject: [dpdk-dev] [PATCH] crypto/virtio: fix memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2018 17:12:08 -0000 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 --- 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 cc7a0b101..568b5a406 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.14.4