From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1DFBEA04F2; Mon, 8 Jun 2020 15:15:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 00C034CBD; Mon, 8 Jun 2020 15:15:11 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 699674C7A for ; Mon, 8 Jun 2020 15:15:09 +0200 (CEST) IronPort-SDR: tAVhx/PUMbD6cKDhS+K3KoZ8n2/46IEFwf1NHU0us1aK0c9rNYmrixRYZortJLsF5ipYErPgoQ GPppZzb9vL4w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2020 06:15:08 -0700 IronPort-SDR: rgYerA+CbrxSwUDeAAF77kzic3DwLHyf5luFp09GukpqOz/FPjYdZp4Vcnd7Axu6r3jENAD/92 k0ATWyOS1blQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="349165798" Received: from unknown (HELO adamdybx-MOBL.ger.corp.intel.com) ([10.104.113.106]) by orsmga001.jf.intel.com with ESMTP; 08 Jun 2020 06:15:07 -0700 From: Adam Dybkowski To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com Cc: Adam Dybkowski Date: Mon, 8 Jun 2020 15:15:03 +0200 Message-Id: <20200608131503.4003-3-adamx.dybkowski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608131503.4003-1-adamx.dybkowski@intel.com> References: <20200608131503.4003-1-adamx.dybkowski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 3/3] crypto/qat: verify session IOVA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds the verification of the crypto session IOVA that should be known (not zero) to proceed with the session initialisation. In case of unknown IOVA the error code -EINVAL is returned. Signed-off-by: Adam Dybkowski --- drivers/crypto/qat/qat_sym_session.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 58bdbd343..11b459ee8 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -537,8 +537,16 @@ qat_sym_session_set_parameters(struct rte_cryptodev *dev, int ret; int qat_cmd_id; + /* Verify the session physical address is known */ + rte_iova_t session_paddr = rte_mempool_virt2iova(session); + if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) { + QAT_LOG(ERR, + "Session physical address unknown. Bad memory pool."); + return -EINVAL; + } + /* Set context descriptor physical address */ - session->cd_paddr = rte_mempool_virt2iova(session) + + session->cd_paddr = session_paddr + offsetof(struct qat_sym_session, cd); session->min_qat_dev_gen = QAT_GEN1; -- 2.25.1