From a0c2b3d8ee501b90eb11c2a82da0aaca19362bd3 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Mon, 27 Jan 2020 11:32:11 -0700 Subject: [PATCH] drivers/crypto: fix session-less mode When OpenSSL or AESNI-MB cryptodev is being used in sessionless mode for symmetric crypto operation (e.g. SHA256 hash), the driver prints error message: CRYPTODEV: set_sym_session_private_data() line 489: Set private data for driver 0 not allowed Then, AESNI-MB driver segfaults in post_process_mb_job(). Bugzilla ID: 377 Fixes: b3bbd9e5f2 ("cryptodev: support device independent sessions") Fixes: c68d7aa354 ("crypto/aesni_mb: use architecture independent macros") Cc: stable@dpdk.org Signed-off-by: Junxiao Shi --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 ++-- drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 97d9f81766..33f4167452 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -729,10 +729,10 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) op->sym->session, cryptodev_driver_id); } else { - void *_sess = NULL; + void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp); void *_sess_private_data = NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) + if (_sess == NULL) return NULL; if (rte_mempool_get(qp->sess_mp_priv, diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 91f028308c..199097bf8c 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -762,10 +762,10 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op) return NULL; /* provide internal session */ - void *_sess = NULL; + void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp); void *_sess_private_data = NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) + if (_sess == NULL) return NULL; if (rte_mempool_get(qp->sess_mp_priv, -- 2.20.1