crypto/qat: fix crash in session create
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Wed, 29 Mar 2017 10:31:46 +0000 (11:31 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 5 Apr 2017 22:17:44 +0000 (00:17 +0200)
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 <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
drivers/crypto/qat/qat_crypto.c
drivers/crypto/qat/qat_crypto.h

index b851926..9310211 100644 (file)
@@ -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;
 }
 
index 78bb2bc..67fa0e1 100644 (file)
@@ -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;