[API-NEXT,v5,16/23] linux-generic: crypto: NULL session->next pointer on session allocation

Message ID 20170601090339.9313-17-dmitry.ereminsolenikov@linaro.org
State Accepted
Commit 8d4ecf491a0af45c499d38c6e72853e756d69f0e
Headers show
Series
  • Major cryptography code rework
Related show

Commit Message

Dmitry Eremin-Solenikov June 1, 2017, 9:03 a.m.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
 platform/linux-generic/odp_crypto.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.11.0

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index ea7c702650f6..32fece308beb 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -88,8 +88,10 @@  odp_crypto_generic_session_t *alloc_session(void)
 
 	odp_spinlock_lock(&global->lock);
 	session = global->free;
-	if (session)
+	if (session) {
 		global->free = session->next;
+		session->next = NULL;
+	}
 	odp_spinlock_unlock(&global->lock);
 
 	return session;