Thread (15 messages) 15 messages, 4 authors, 2017-09-06

Re: [PATCH v2] cryptodev: fix NULL pointer dereference

From: De Lara Guarch, Pablo <hidden>
Date: 2017-08-01 07:12:10

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
Sent: Monday, July 31, 2017 8:33 PM
To: De Lara Guarch, Pablo <redacted>
Cc: Gonzalez Monroy, Sergio <redacted>;
dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] cryptodev: fix NULL pointer dereference

31/07/2017 11:18, Pablo de Lara:
quoted
When register a crypto driver, a cryptodev driver structure was being
allocated, using malloc.
Since this call may fail, it is safer to allocate this memory
statically in each PMD, so driver registration will never fail.

Coverity issue: 158645

Fixes: 7a364faef185 ("cryptodev: remove crypto device type
enumeration")

Signed-off-by: Pablo de Lara <redacted>
---

Changes in v2:

- Allocate statically the cryptodev driver structure,
  instead of using malloc, that can potentially fail.

 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c    |  5 ++++-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c  |  6 +++++-
 drivers/crypto/armv8/rte_armv8_pmd.c        |  9 ++++++---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c |  5 ++++-
 drivers/crypto/kasumi/rte_kasumi_pmd.c      |  5 ++++-
 drivers/crypto/null/null_crypto_pmd.c       |  5 ++++-
 drivers/crypto/openssl/rte_openssl_pmd.c    |  5 ++++-
 drivers/crypto/qat/rte_qat_cryptodev.c      |  7 +++++--
 drivers/crypto/scheduler/scheduler_pmd.c    |  5 ++++-
 drivers/crypto/snow3g/rte_snow3g_pmd.c      |  5 ++++-
 drivers/crypto/zuc/rte_zuc_pmd.c            |  5 ++++-
 lib/librte_cryptodev/rte_cryptodev.c        | 18 +++++------------
 lib/librte_cryptodev/rte_cryptodev.h        | 20 -------------------
 lib/librte_cryptodev/rte_cryptodev_pmd.h    | 30
+++++++++++++++++++++++++++++
quoted
 14 files changed, 83 insertions(+), 47 deletions(-)
This is a big change for a small/unlikely issue.
The main benefit of this patch is an allocation cleanup.
I think it is better to wait 17.11 cycle to integrate it.
Makes sense, Thomas.

Thanks,
Pablo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help