From: Arek Kusztal Date: Wed, 29 Mar 2017 10:31:46 +0000 (+0100) Subject: crypto/qat: fix crash in session create X-Git-Tag: spdx-start~3716 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d099195ae7e0a64aaeba6fed290536f403dd5fe0;p=dpdk.git crypto/qat: fix crash in session create This patch fixes segementation fault that may occur in case of wrong parameters being provided to the cryptographic session. Unused fields which would cause null dereference are removed. Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices") Signed-off-by: Arek Kusztal Acked-by: Fiona Trahe --- diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index b851926d79..931021101a 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -739,11 +739,9 @@ qat_get_cipher_xform(struct rte_crypto_sym_xform *xform) return NULL; } void * -qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev, +qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev __rte_unused, struct rte_crypto_sym_xform *xform, void *session_private) { - struct qat_pmd_private *internals = dev->data->dev_private; - struct qat_session *session = session_private; struct rte_crypto_cipher_xform *cipher_xform = NULL; @@ -884,7 +882,6 @@ error_out: bpi_cipher_ctx_free(session->bpi_ctx); session->bpi_ctx = NULL; } - rte_mempool_put(internals->sess_mp, session); return NULL; } @@ -893,8 +890,6 @@ void * qat_crypto_sym_configure_session(struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, void *session_private) { - struct qat_pmd_private *internals = dev->data->dev_private; - struct qat_session *session = session_private; int qat_cmd_id; @@ -943,17 +938,15 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev, return session; error_out: - rte_mempool_put(internals->sess_mp, session); return NULL; } struct qat_session * -qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, +qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev __rte_unused, struct rte_crypto_sym_xform *xform, struct qat_session *session_private) { - struct qat_pmd_private *internals = dev->data->dev_private; struct qat_session *session = session_private; struct rte_crypto_auth_xform *auth_xform = NULL; struct rte_crypto_cipher_xform *cipher_xform = NULL; @@ -1038,8 +1031,6 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, return session; error_out: - if (internals->sess_mp != NULL) - rte_mempool_put(internals->sess_mp, session); return NULL; } diff --git a/drivers/crypto/qat/qat_crypto.h b/drivers/crypto/qat/qat_crypto.h index 78bb2bcb7b..67fa0e1efa 100644 --- a/drivers/crypto/qat/qat_crypto.h +++ b/drivers/crypto/qat/qat_crypto.h @@ -76,9 +76,6 @@ struct qat_qp { /** private data structure for each QAT device */ struct qat_pmd_private { - char sess_mp_name[RTE_MEMPOOL_NAMESIZE]; - struct rte_mempool *sess_mp; - unsigned max_nb_queue_pairs; /**< Max number of queue pairs supported by device */ unsigned max_nb_sessions;