From patchwork Tue Jul 5 13:28:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ji, Kai" X-Patchwork-Id: 113676 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 133BFA0542; Tue, 5 Jul 2022 15:28:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DF324021D; Tue, 5 Jul 2022 15:28:32 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 11537400D7; Tue, 5 Jul 2022 15:28:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657027711; x=1688563711; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=JfMOhHK+REkOEBnuRlqsnbg2Fe1CNygKJ2k7PBSv8hc=; b=Xmx5UwlGIldHAIXl6AzU2T/RuaOO+4fCal0c2eKhZnNZYCFQf87hKEOr 6GPWlekZoI/Zgu7t05RQm8dRsMV4v6mI5NgmMMqxlap9xnDaMxurmZucq RGg6pexnybSg/ilsGVxhnimeENdZ69WuDK0B2qhhgzbkljwrEeHPBveRA bW5OJUtsWTvAf9EqQSBJq9QmGcR/w9XXRo8QpX7B3ZZtmhg3yZmJ1w+Xo GsRm7G0WzHVZ35dtn7UnqQ/1Qxec3JhDWnbPA4fG7UyipdmL+EcqqYKGH RNqEbELUKzMW3hEkvBKa+jWRuwHzFvceZmCKu+UCm6o0z4uG/xetPGW9K Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10398"; a="284085521" X-IronPort-AV: E=Sophos;i="5.92,247,1650956400"; d="scan'208";a="284085521" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 06:28:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,247,1650956400"; d="scan'208";a="682520300" Received: from silpixa00400465.ir.intel.com ([10.55.128.22]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jul 2022 06:28:28 -0700 From: Kai Ji To: dev@dpdk.org Cc: gakhil@marvell.com, Rebecca Troy , stable@dpdk.org, Kai Ji Subject: [dpdk-dev v2] crypto/qat: fix secure session check Date: Tue, 5 Jul 2022 21:28:18 +0800 Message-Id: <20220705132818.44687-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220701085707.246099-1-rebecca.troy@intel.com> References: <20220701085707.246099-1-rebecca.troy@intel.com> 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 From: Rebecca Troy 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 Signed-off-by: Kai Ji --- drivers/crypto/qat/qat_sym.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 3477cd89ad..db6316fbe9 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -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"