crypto/dpaa_sec: add check for segmented buffer
authorAlok Makhariya <alok.makhariya@nxp.com>
Fri, 13 Oct 2017 15:37:30 +0000 (21:07 +0530)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 25 Oct 2017 16:10:15 +0000 (18:10 +0200)
The code would crash in case of segmented buffer if no check

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

Signed-off-by: Alok Makhariya <alok.makhariya@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
drivers/crypto/dpaa_sec/dpaa_sec.c

index b54803c..53f004e 100644 (file)
@@ -890,6 +890,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)) {