crypto: add barrier in crypto key add 47/34247/2
authorGabriel Oginski <gabrielx.oginski@intel.com>
Tue, 26 Oct 2021 06:43:33 +0000 (07:43 +0100)
committerDamjan Marion <dmarion@me.com>
Tue, 26 Oct 2021 16:30:50 +0000 (16:30 +0000)
commitc12d48f4e61cabe4352b2ab3e23618cabb7fae06
treec167992bafe384a6e79638c69ee483ae96988840
parentdec79ecf39c95054f3c7fbbf6019a032410a0231
crypto: add barrier in crypto key add

Originally the pool of keys can be expand and cache with pointer for
key can be invalid.
For example in Wireguard during handshake process this pool can be
expand and pointer for these keys in cache can be invalid for workers
or can has incorrect value (poison memory).

The fixes add barrier if the pool needs be to expand to ensure that
cache in function will be valid and avoid situation when cache has
invalid pointer for these keys.

Type: fix

Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Ida8f300213dfebb91ecaf1937fb08de81c20ba7b
src/vnet/crypto/crypto.c