diff mbox

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

Message ID 20171013153730.8395-1-alok.makhariya@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Pablo de Lara Guarch
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

alok.makhariya@nxp.com Oct. 13, 2017, 3:37 p.m. UTC
From: Alok Makhariya <alok.makhariya@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@nxp.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Akhil Goyal Oct. 13, 2017, 3:45 p.m. UTC | #1
On 10/13/2017 9:07 PM, alok.makhariya@nxp.com wrote:
> From: Alok Makhariya <alok.makhariya@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@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)) {
> 
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Pablo de Lara Oct. 16, 2017, 2:07 p.m. UTC | #2
> -----Original Message-----

> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]

> Sent: Friday, October 13, 2017 4:45 PM

> To: alok.makhariya@nxp.com; dev@dpdk.org

> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;

> hemant.agrawal@nxp.com

> Subject: Re: [PATCH v2] crypto/dpaa_sec: add check for segmented buffer

> 

> On 10/13/2017 9:07 PM, alok.makhariya@nxp.com wrote:

> > From: Alok Makhariya <alok.makhariya@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@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)) {

> >

> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>


Applied to dpdk-next-crypto.
Thanks,

Pablo
diff mbox

Patch

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)) {