crypto/aesni_mb: fix invalid session error
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Thu, 7 Sep 2017 11:50:36 +0000 (12:50 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 12 Oct 2017 14:10:52 +0000 (15:10 +0100)
Setting an invalid session in the crypto op results in SEGFAULT because
the JOB user_data was never set to the crypto op.

Fixes: 0f548b50a160 ("crypto/aesni_mb: process crypto op on dequeue")
Cc: stable@dpdk.org
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c

index 1d93b8e..f91504d 100644 (file)
@@ -609,13 +609,16 @@ flush_mb_mgr(struct aesni_mb_qp *qp, struct rte_crypto_op **ops,
 }
 
 static inline JOB_AES_HMAC *
-set_job_null_op(JOB_AES_HMAC *job)
+set_job_null_op(JOB_AES_HMAC *job, struct rte_crypto_op *op)
 {
        job->chain_order = HASH_CIPHER;
        job->cipher_mode = NULL_CIPHER;
        job->hash_alg = NULL_HASH;
        job->cipher_direction = DECRYPT;
 
+       /* Set user data to be crypto operation data struct */
+       job->user_data = op;
+
        return job;
 }
 
@@ -654,7 +657,7 @@ aesni_mb_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
                retval = set_mb_job_params(job, qp, op, &digest_idx);
                if (unlikely(retval != 0)) {
                        qp->stats.dequeue_err_count++;
-                       set_job_null_op(job);
+                       set_job_null_op(job, op);
                }
 
                /* Submit job to multi-buffer for processing */