crypto/aesni_mb: check if session is valid
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Mon, 20 Apr 2020 11:05:29 +0000 (12:05 +0100)
committerAkhil Goyal <akhil.goyal@nxp.com>
Mon, 11 May 2020 11:17:43 +0000 (13:17 +0200)
Check if session is valid after getting operation
out of the internal IPSec MB manager, in case the
session has been freed while the operation was still
inside the manager.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c

index a1d59e8..4bfc752 100644 (file)
@@ -1178,6 +1178,10 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
        struct aesni_mb_session *sess = get_sym_session_private_data(
                                                        op->sym->session,
                                                        cryptodev_driver_id);
+       if (unlikely(sess == NULL)) {
+               op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+               return op;
+       }
 
        if (likely(op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)) {
                switch (job->status) {