tpm: fix a race condition in tpm2_unseal_trusted()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 16 Aug 2016 19:00:38 +0000 (22:00 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2016 15:36:15 +0000 (17:36 +0200)
commitc0201ae6796a830fa7eb0cb537239102bedcbcc5
tree6fa9c6ca61906a98a7e42d5e8eabeac1f7ce7c6f
parent0040b7466cbd6d7a7f84d0eed86e328da21c0e27
tpm: fix a race condition in tpm2_unseal_trusted()

commit d4816edfe706497a8525480c1685ceb9871bc118 upstream.

Unseal and load operations should be done as an atomic operation. This
commit introduces unlocked tpm_transmit() so that tpm2_unseal_trusted()
can do the locking by itself.

Fixes: 0fe5480303a1 ("keys, trusted: seal/unseal with TPM 2.0 chips")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm-dev.c
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm-sysfs.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm2-cmd.c