Message ID | 20200608131503.4003-3-adamx.dybkowski@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | akhil goyal |
Headers | show |
Series | [1/3] test/crypto: fix asym session mempool creation | expand |
Context | Check | Description |
---|---|---|
ci/Intel-compilation | success | Compilation OK |
ci/travis-robot | success | Travis build: passed |
ci/checkpatch | success | coding style OK |
> -----Original Message----- > From: Dybkowski, AdamX <adamx.dybkowski@intel.com> > Sent: Monday, June 8, 2020 2:15 PM > To: dev@dpdk.org; Trahe, Fiona <fiona.trahe@intel.com>; akhil.goyal@nxp.com > Cc: Dybkowski, AdamX <adamx.dybkowski@intel.com> > Subject: [PATCH 3/3] crypto/qat: verify session IOVA > > 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> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
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;
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(-)