]> git.droids-corp.org - dpdk.git/commitdiff
drivers/crypto: fix PMDs memory leak
authorFan Zhang <roy.fan.zhang@intel.com>
Fri, 21 Dec 2018 14:11:05 +0000 (14:11 +0000)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 10 Jan 2019 15:57:22 +0000 (16:57 +0100)
This patch fixes the memory leak during queue pair release.
Originally the operation ring is not freed when releasing
queue pair, causing the next queue_pair configure call fail
and memory leak.

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")
Fixes: cf7685d68f00 ("crypto/zuc: add driver for ZUC library")
Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
Fixes: 3aafc423cf4d ("snow3g: add driver for SNOW 3G library")
Fixes: 94b0ad8e0aa5 ("null_crypto: add driver for null crypto operations")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
drivers/crypto/null/null_crypto_pmd_ops.c
drivers/crypto/openssl/rte_openssl_pmd_ops.c
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
drivers/crypto/zuc/rte_zuc_pmd_ops.c

index c343a393f36a677b1fa905f3e1e4ea8349301aa1..cd15245bdde2ea1e97a6d37f64bbd27a74d72110 100644 (file)
@@ -153,6 +153,11 @@ static int
 aesni_gcm_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
        if (dev->data->queue_pairs[qp_id] != NULL) {
+               struct aesni_gcm_qp *qp = dev->data->queue_pairs[qp_id];
+
+               if (qp->processed_pkts)
+                       rte_ring_free(qp->processed_pkts);
+
                rte_free(dev->data->queue_pairs[qp_id]);
                dev->data->queue_pairs[qp_id] = NULL;
        }
index 2bdcd019ef471a78da0000faa49b075d5773914f..319ca34e75bae50e6e678731cee74aaecd52fb07 100644 (file)
@@ -133,6 +133,11 @@ static int
 null_crypto_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
        if (dev->data->queue_pairs[qp_id] != NULL) {
+               struct null_crypto_qp *qp = dev->data->queue_pairs[qp_id];
+
+               if (qp->processed_pkts)
+                       rte_ring_free(qp->processed_pkts);
+
                rte_free(dev->data->queue_pairs[qp_id]);
                dev->data->queue_pairs[qp_id] = NULL;
        }
index bdaf937a3ecde80acc059f9081719b4b452be04d..d382476a6abff7c1bfd4ad3288a1c0b7cf1ab2d9 100644 (file)
@@ -657,6 +657,11 @@ static int
 openssl_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
        if (dev->data->queue_pairs[qp_id] != NULL) {
+               struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
+
+               if (qp->processed_ops)
+                       rte_ring_free(qp->processed_ops);
+
                rte_free(dev->data->queue_pairs[qp_id]);
                dev->data->queue_pairs[qp_id] = NULL;
        }
index cfbc9522a4f4c20dd6bc0e1d7647e5a963e8a6a0..a367ee9a065824960de854976762edba5414e844 100644 (file)
@@ -142,6 +142,11 @@ static int
 snow3g_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
        if (dev->data->queue_pairs[qp_id] != NULL) {
+               struct snow3g_qp *qp = dev->data->queue_pairs[qp_id];
+
+               if (qp->processed_ops)
+                       rte_ring_free(qp->processed_ops);
+
                rte_free(dev->data->queue_pairs[qp_id]);
                dev->data->queue_pairs[qp_id] = NULL;
        }
index 6da396542755be57e4ed671f531f74c5db5e1c2f..04d45e4498ba85dcb6db21dcd0d7b5e996b9bc66 100644 (file)
@@ -142,6 +142,11 @@ static int
 zuc_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
        if (dev->data->queue_pairs[qp_id] != NULL) {
+               struct zuc_qp *qp = dev->data->queue_pairs[qp_id];
+
+               if (qp->processed_ops)
+                       rte_ring_free(qp->processed_ops);
+
                rte_free(dev->data->queue_pairs[qp_id]);
                dev->data->queue_pairs[qp_id] = NULL;
        }