From patchwork Fri Jul 1 08:57:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Troy X-Patchwork-Id: 113602 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41FE9A00C2; Fri, 1 Jul 2022 10:57:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B1504069D; Fri, 1 Jul 2022 10:57:20 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 0F35140150; Fri, 1 Jul 2022 10:57:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656665839; x=1688201839; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=R9New69+8q4lcHdH1sMj7Y1Kps6Del4gz0iKU4DyvW4=; b=ihLSiLBzsZ6C8oiqn5CY5rOGmVxB77Z7dklYp/rqwA5h+fkKtqe7SmVO Ja/n5nmQKi4+aksjAQgaRFX5ooPzUkZxAXT+xUn9wpeD7r9KjWAhFtjSV qOIQDX5XHqTwyTMmtl8a/pdsa//Qr6Sn+S/5h0lpvLn2jmo0N6g/MRinr 3AmcQQ04I/20cE3R1mBTubswpKr0ik+ePlqSoUdQPKN3mqGlM3CZpfEb4 xxPvPDAr6LMhb3HJ/44vRr52dgGD9q2k6omayBcDIeYKISB6KxBhuI7hQ Gb/pujJzFl5WsFWvKgpafxwZw3R2zpag54CGZU9KyoJp9dcDP35OBJrWy Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10394"; a="280149244" X-IronPort-AV: E=Sophos;i="5.92,236,1650956400"; d="scan'208";a="280149244" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 01:57:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,236,1650956400"; d="scan'208";a="648266207" Received: from silpixa00401279.ir.intel.com (HELO silpixa00401279.ger.corp.intel.com) ([10.237.222.42]) by fmsmga008.fm.intel.com with ESMTP; 01 Jul 2022 01:57:16 -0700 From: Rebecca Troy To: Fan Zhang Cc: dev@dpdk.org, Rebecca Troy , kai.ji@intel.com, stable@dpdk.org Subject: [PATCH] crypto/qat: fix secure session check Date: Fri, 1 Jul 2022 08:57:07 +0000 Message-Id: <20220701085707.246099-1-rebecca.troy@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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: kai.ji@intel.com Cc: stable@dpdk.org Signed-off-by: Rebecca Troy --- drivers/crypto/qat/qat_sym.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 3477cd89ad..e5ae670b3a 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -105,16 +105,16 @@ 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) { - struct rte_cryptodev *cdev; - struct qat_cryptodev_private *internals; - - ctx = get_sec_session_private_data( + 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; + if (unlikely(ctx->bpi_ctx == NULL)) { QAT_DP_LOG(ERR, "QAT PMD only supports security" " operation requests for"