Currently, for a sessionless op, the session created is reset before
being put back into the mempool. This causes issues as the object isn't
correctly released into the mempool.

Fixes: c68d7aa354f6 ("crypto/aesni_mb: use architecture independent macros")
Fixes: b3bbd9e5f265 ("cryptodev: support device independent sessions")
Fixes: f16662885472 ("crypto/ipsec_mb: add chacha_poly PMD")
Cc: roy.fan.zh...@intel.com
Cc: slawomirx.mrozow...@intel.com
Cc: kai...@intel.com

Signed-off-by: Ciara Power <ciara.po...@intel.com>
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c    | 4 ----
 drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 4 ----
 drivers/crypto/ipsec_mb/pmd_kasumi.c      | 5 -----
 drivers/crypto/ipsec_mb/pmd_snow3g.c      | 4 ----
 drivers/crypto/ipsec_mb/pmd_zuc.c         | 4 ----
 5 files changed, 21 deletions(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c 
b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 6d5d3ce8eb..944fce0261 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1770,10 +1770,6 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job)
 
        /* Free session if a session-less crypto op */
        if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-               memset(sess, 0, sizeof(struct aesni_mb_session));
-               memset(op->sym->session, 0,
-                       rte_cryptodev_sym_get_existing_header_session_size(
-                               op->sym->session));
                rte_mempool_put(qp->sess_mp_priv, sess);
                rte_mempool_put(qp->sess_mp, op->sym->session);
                op->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c 
b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
index d953d6e5f5..31397b6395 100644
--- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
+++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c
@@ -289,10 +289,6 @@ handle_completed_chacha20_poly1305_crypto_op(struct 
ipsec_mb_qp *qp,
 
        /* Free session if a session-less crypto op */
        if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-               memset(sess, 0, sizeof(struct chacha20_poly1305_session));
-               memset(op->sym->session, 0,
-                       rte_cryptodev_sym_get_existing_header_session_size(
-                               op->sym->session));
                rte_mempool_put(qp->sess_mp_priv, sess);
                rte_mempool_put(qp->sess_mp, op->sym->session);
                op->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c 
b/drivers/crypto/ipsec_mb/pmd_kasumi.c
index c9d4f9d0ae..de37e012bd 100644
--- a/drivers/crypto/ipsec_mb/pmd_kasumi.c
+++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c
@@ -230,11 +230,6 @@ process_ops(struct rte_crypto_op **ops, struct 
kasumi_session *session,
                        ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
                /* Free session if a session-less crypto op. */
                if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-                       memset(session, 0, sizeof(struct kasumi_session));
-                       memset(
-                           ops[i]->sym->session, 0,
-                           rte_cryptodev_sym_get_existing_header_session_size(
-                               ops[i]->sym->session));
                        rte_mempool_put(qp->sess_mp_priv, session);
                        rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
                        ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c 
b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index 9a85f46721..1634c54fb7 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -361,10 +361,6 @@ process_ops(struct rte_crypto_op **ops, struct 
snow3g_session *session,
                        ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
                /* Free session if a session-less crypto op. */
                if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-                       memset(session, 0, sizeof(struct snow3g_session));
-                       memset(ops[i]->sym->session, 0,
-                       rte_cryptodev_sym_get_existing_header_session_size(
-                                       ops[i]->sym->session));
                        rte_mempool_put(qp->sess_mp_priv, session);
                        rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
                        ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c 
b/drivers/crypto/ipsec_mb/pmd_zuc.c
index e36c7092d6..564ca3457c 100644
--- a/drivers/crypto/ipsec_mb/pmd_zuc.c
+++ b/drivers/crypto/ipsec_mb/pmd_zuc.c
@@ -238,10 +238,6 @@ process_ops(struct rte_crypto_op **ops, enum 
ipsec_mb_operation op_type,
                        ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
                /* Free session if a session-less crypto op. */
                if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-                       memset(sessions[i], 0, sizeof(struct zuc_session));
-                       memset(ops[i]->sym->session, 0,
-                       rte_cryptodev_sym_get_existing_header_session_size(
-                                       ops[i]->sym->session));
                        rte_mempool_put(qp->sess_mp_priv, sessions[i]);
                        rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
                        ops[i]->sym->session = NULL;
-- 
2.25.1

Reply via email to