Fixed a linked list manipulation bug.

Consider the case where you start with A->B->C and you remove B. Before
this fix, both A and B were removed from the list. This resulted in a
dangling reference to A in the key manager and invalid key handle errors
when A was next referenced. Also this resulted in A not being evicted /
flushed from the TPM when Tspi_Key_UnloadKey was called.

TEST=Run the platform_Pkcs11Events autotest.

Change-Id: If1fd6612ae13a6a1f558a9dcaa8e36f9b5eea577
Reviewed-by: Gaurav Shah <>
Tested-by: Darren Krahn <>
Commit-Ready: Darren Krahn <>
1 file changed