From: Dmitry Eremin-Solenikov <[email protected]>

Some paths during odp_ipsec_sa_create() can lead to SA leakage. Fix
them by always releasing SA in error case.

Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
/** Email created from pull request 288 (lumag:gmac)
 ** https://github.com/Linaro/odp/pull/288
 ** Patch: https://github.com/Linaro/odp/pull/288.patch
 ** Base sha: d22c949cc466bf28de559855a1cb525740578137
 ** Merge commit sha: ba7b9d98bb5dfe0cf7d7d28767c7a9c02d421d2d
 **/
 platform/linux-generic/odp_ipsec_sad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_ipsec_sad.c 
b/platform/linux-generic/odp_ipsec_sad.c
index 5d20bb66c..457b81d04 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -292,7 +292,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
                ipsec_sa->icv_len = 16;
                break;
        default:
-               return ODP_IPSEC_SA_INVALID;
+               goto error;
        }
 
        switch (crypto_param.cipher_alg) {
@@ -322,7 +322,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
                crypto_param.iv.length = 12;
                break;
        default:
-               return ODP_IPSEC_SA_INVALID;
+               goto error;
        }
 
        if (1 == ipsec_sa->use_counter_iv &&

Reply via email to