]> git.droids-corp.org - dpdk.git/commitdiff
crypto/qat: fix secure session check
authorRebecca Troy <rebecca.troy@intel.com>
Tue, 5 Jul 2022 13:28:18 +0000 (21:28 +0800)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 5 Jul 2022 15:44:10 +0000 (17:44 +0200)
Currently when running the dpdk-perf-test with DOCSIS
security sessions, a segmentation fault occurs. This
is due to the check being made that the session is not
equal to op->sym->sec_session. This check passes the
first time but on the second iteration fails and doesn't
create the build_request.

This commit fixes that error by getting the ctx first
from the private session data and then comparing ctx,
rather than op->sym->sec_session, with the sess.

Fixes: fb3b9f492205 ("crypto/qat: rework burst data path")
Cc: stable@dpdk.org
Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
Signed-off-by: Kai Ji <kai.ji@intel.com>
drivers/crypto/qat/qat_sym.c

index 3477cd89ad9e1d8f4ed305a3ada3b3e6a6085e62..db6316fbe9c4d18364abb372b34c95f840898833 100644 (file)
@@ -105,16 +105,15 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 
 #ifdef RTE_LIB_SECURITY
        else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
-               if ((void *)sess != (void *)op->sym->sec_session) {
+               ctx = get_sec_session_private_data(op->sym->sec_session);
+               if (unlikely(!ctx)) {
+                       QAT_DP_LOG(ERR, "No session for this device");
+                       return -EINVAL;
+               }
+               if (sess != (uintptr_t)ctx) {
                        struct rte_cryptodev *cdev;
                        struct qat_cryptodev_private *internals;
 
-                       ctx = get_sec_session_private_data(
-                                       op->sym->sec_session);
-                       if (unlikely(!ctx)) {
-                               QAT_DP_LOG(ERR, "No session for this device");
-                               return -EINVAL;
-                       }
                        if (unlikely(ctx->bpi_ctx == NULL)) {
                                QAT_DP_LOG(ERR, "QAT PMD only supports security"
                                                " operation requests for"