Fix bug in dpdk_crypto_session_disposal() 02/10802/2
authorMatthew Smith <mgsmith@netgate.com>
Sun, 25 Feb 2018 02:51:53 +0000 (20:51 -0600)
committerDamjan Marion <dmarion.lists@gmail.com>
Sun, 25 Feb 2018 22:04:27 +0000 (22:04 +0000)
The expression to determine whether to delete a session
from the disposal list only evaluates true if some,
but not all, of the sessions in the list were freed.
When all sessions in the list are freed, it evaluates
false and the sessions are left in the list to be freed
again later, which can result in a session pool element
that was reallocated to a different SA being freed,
breaking crypto for the newer SA.

Add an 'else' that handles the case where all sessions
were freed.

Change-Id: I3ae54d5b3bfc3658bf406caa50646924baaae589
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
src/plugins/dpdk/ipsec/ipsec.c

index dbb069c..9be7b3b 100644 (file)
@@ -467,6 +467,8 @@ dpdk_crypto_session_disposal (crypto_session_disposal_t * v, u64 ts)
 
   if (s < vec_end (v))
     vec_delete (v, s - v, 0);
+  else
+    vec_reset_length (v);
 
   return 0;
 }