[dpdk-dev] [PATCH v2] crypto/dpaa_sec: add check for segmented buffer

alok.makhariya at nxp.com alok.makhariya at nxp.com
Fri Oct 13 17:37:30 CEST 2017


From: Alok Makhariya <alok.makhariya at nxp.com>

The code would crash in case of segmented buffer if no check

Fixes: 89aaf708d44b ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform")

Signed-off-by: Alok Makhariya <alok.makhariya at nxp.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7b9a683..bd13d8c 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -893,6 +893,13 @@ dpaa_sec_enqueue_op(struct rte_crypto_op *op,  struct dpaa_sec_qp *qp)
 			return ret;
 	}
 
+	/*
+	 * Segmented buffer is not supported.
+	 */
+	if (!rte_pktmbuf_is_contiguous(op->sym->m_src)) {
+		op->status = RTE_CRYPTO_OP_STATUS_ERROR;
+		return -ENOTSUP;
+	}
 	if (is_auth_only(ses)) {
 		cf = build_auth_only(op, ses);
 	} else if (is_cipher_only(ses)) {
-- 
2.9.3



More information about the dev mailing list