DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com
Cc: Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH 3/3] crypto/qat: verify session IOVA
Date: Mon,  8 Jun 2020 15:15:03 +0200	[thread overview]
Message-ID: <20200608131503.4003-3-adamx.dybkowski@intel.com> (raw)
In-Reply-To: <20200608131503.4003-1-adamx.dybkowski@intel.com>

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 <adamx.dybkowski@intel.com>
---
 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


  parent reply	other threads:[~2020-06-08 13:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 13:15 [dpdk-dev] [PATCH 1/3] test/crypto: fix asym session mempool creation Adam Dybkowski
2020-06-08 13:15 ` [dpdk-dev] [PATCH 2/3] cryptodev: verify session mempool element size Adam Dybkowski
2020-06-24 14:56   ` Trahe, Fiona
2020-07-01 19:54     ` Akhil Goyal
2020-06-08 13:15 ` Adam Dybkowski [this message]
2020-06-24 15:08   ` [dpdk-dev] [PATCH 3/3] crypto/qat: verify session IOVA Trahe, Fiona
2020-06-24 14:49 ` [dpdk-dev] [PATCH 1/3] test/crypto: fix asym session mempool creation Trahe, Fiona
2020-07-01 19:53   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200608131503.4003-3-adamx.dybkowski@intel.com \
    --to=adamx.dybkowski@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).