summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVipin Varghese <vipin.varghese@intel.com>2018-10-12 15:23:46 +0530
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-26 22:14:06 +0200
commit93e11beebc49ad5ab7ea3d146da911caa8064bd1 (patch)
tree030d392e3f4a63523459c2707fce7d47f2dcad40 /drivers
parent8fae42404cab6c9ad7e7683a1bebf891ba1192ac (diff)
downloaddpdk-93e11beebc49ad5ab7ea3d146da911caa8064bd1.zip
dpdk-93e11beebc49ad5ab7ea3d146da911caa8064bd1.tar.gz
dpdk-93e11beebc49ad5ab7ea3d146da911caa8064bd1.tar.xz
net/ixgbe: prevent ic session leak on failure
For function ixgbe_crypto_create_session, fetches ic_session from the mempool. But on failure scenarios, the object is not released back to mempool. Using rte_mempool_put the ic_session is put back to mempool. Signed-off-by: Vipin Varghese <vipin.varghese@intel.com> Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ixgbe/ixgbe_ipsec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 683ab88..5a41688 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -364,6 +364,7 @@ ixgbe_crypto_create_session(void *device,
conf->crypto_xform->aead.algo !=
RTE_CRYPTO_AEAD_AES_GCM) {
PMD_DRV_LOG(ERR, "Unsupported crypto transformation mode\n");
+ rte_mempool_put(mempool, (void *)ic_session);
return -ENOTSUP;
}
aead_xform = &conf->crypto_xform->aead;
@@ -373,6 +374,7 @@ ixgbe_crypto_create_session(void *device,
ic_session->op = IXGBE_OP_AUTHENTICATED_DECRYPTION;
} else {
PMD_DRV_LOG(ERR, "IPsec decryption not enabled\n");
+ rte_mempool_put(mempool, (void *)ic_session);
return -ENOTSUP;
}
} else {
@@ -380,6 +382,7 @@ ixgbe_crypto_create_session(void *device,
ic_session->op = IXGBE_OP_AUTHENTICATED_ENCRYPTION;
} else {
PMD_DRV_LOG(ERR, "IPsec encryption not enabled\n");
+ rte_mempool_put(mempool, (void *)ic_session);
return -ENOTSUP;
}
}
@@ -395,6 +398,7 @@ ixgbe_crypto_create_session(void *device,
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
if (ixgbe_crypto_add_sa(ic_session)) {
PMD_DRV_LOG(ERR, "Failed to add SA\n");
+ rte_mempool_put(mempool, (void *)ic_session);
return -EPERM;
}
}