crypto/armv8: fix mempool object returning
authorRuifeng Wang <ruifeng.wang@arm.com>
Mon, 31 Aug 2020 08:51:44 +0000 (16:51 +0800)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 14 Oct 2020 19:34:04 +0000 (21:34 +0200)
Crypto session and device session private data were put back
to wrong pools.
This caused data corruption when the object was reallocated and used.
Because objects from different mempools have different element size,
and wrong mempool info caused out of bound write.
Fix the issue by putting back objects to correct mempools.

Fixes: b3bbd9e5f265 ("cryptodev: support device independent sessions")
Fixes: 725d2a7fbf71 ("cryptodev: change queue pair configure structure")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
drivers/crypto/armv8/rte_armv8_pmd.c

index c95729d..72d29ae 100644 (file)
@@ -674,8 +674,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
                memset(op->sym->session, 0,
                        rte_cryptodev_sym_get_existing_header_session_size(
                                op->sym->session));
-               rte_mempool_put(qp->sess_mp, sess);
-               rte_mempool_put(qp->sess_mp_priv, op->sym->session);
+               rte_mempool_put(qp->sess_mp_priv, sess);
+               rte_mempool_put(qp->sess_mp, op->sym->session);
                op->sym->session = NULL;
        }