[dpdk-dev,v2] aesni_mb: fix null pointer dereferencing

Message ID 1465292171-189465-1-git-send-email-deepak.k.jain@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Deepak Kumar JAIN June 7, 2016, 9:36 a.m. UTC
  Fix null pointer dereferencing by reporing if null and
exiting the function.

Coverity issue: 126584
Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
v2: Corrected PMD name in commit message

 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo June 7, 2016, 11:04 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jain, Deepak K
> Sent: Tuesday, June 07, 2016 10:36 AM
> To: dev@dpdk.org
> Cc: Doherty, Declan; Jain, Deepak K
> Subject: [dpdk-dev] [PATCH v2] aesni_mb: fix null pointer dereferencing
> 
> Fix null pointer dereferencing by reporing if null and
> exiting the function.
> 
> Coverity issue: 126584
> Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented")
> 
> Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Thomas Monjalon June 7, 2016, 2:34 p.m. UTC | #2
> > Fix null pointer dereferencing by reporing if null and
> > exiting the function.
> > 
> > Coverity issue: 126584
> > Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented")
> > 
> > Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks
  

Patch

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 9c42f88..31784e1 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -379,9 +379,11 @@  process_crypto_op(struct aesni_mb_qp *qp, struct rte_crypto_op *op,
 		/* append space for output data to mbuf */
 		char *odata = rte_pktmbuf_append(m_dst,
 				rte_pktmbuf_data_len(op->sym->m_src));
-		if (odata == NULL)
+		if (odata == NULL) {
 			MB_LOG_ERR("failed to allocate space in destination "
 					"mbuf for source data");
+			return NULL;
+		}
 
 		memcpy(odata, rte_pktmbuf_mtod(op->sym->m_src, void*),
 				rte_pktmbuf_data_len(op->sym->m_src));