Skip to content

Commit 45477b3

Browse files
James BottomleyJarkko Sakkinen
authored andcommitted
security: keys: trusted: fix lost handle flush
The original code, before it was moved into security/keys/trusted-keys had a flush after the blob unseal. Without that flush, the volatile handles increase in the TPM until it becomes unusable and the system either has to be rebooted or the TPM volatile area manually flushed. Fix by adding back the lost flush, which we now have to export because of the relocation of the trusted key code may cause the consumer to be modular. Signed-off-by: James Bottomley <[email protected]> Fixes: 2e19e10 ("KEYS: trusted: Move TPM2 trusted keys code") Reviewed-by: Jerry Snitselaar <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 21df4a8 commit 45477b3

File tree

4 files changed

+3
-1
lines changed

4 files changed

+3
-1
lines changed

drivers/char/tpm/tpm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx,
218218
int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
219219
struct tpm_digest *digests);
220220
int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max);
221-
void tpm2_flush_context(struct tpm_chip *chip, u32 handle);
222221
ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id,
223222
u32 *value, const char *desc);
224223

drivers/char/tpm/tpm2-cmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ void tpm2_flush_context(struct tpm_chip *chip, u32 handle)
362362
tpm_transmit_cmd(chip, &buf, 0, "flushing context");
363363
tpm_buf_destroy(&buf);
364364
}
365+
EXPORT_SYMBOL_GPL(tpm2_flush_context);
365366

366367
struct tpm2_get_cap_out {
367368
u8 more_data;

include/linux/tpm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
403403
extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen);
404404
extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max);
405405
extern struct tpm_chip *tpm_default_chip(void);
406+
void tpm2_flush_context(struct tpm_chip *chip, u32 handle);
406407
#else
407408
static inline int tpm_is_tpm2(struct tpm_chip *chip)
408409
{

security/keys/trusted-keys/trusted_tpm2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ int tpm2_unseal_trusted(struct tpm_chip *chip,
309309
return rc;
310310

311311
rc = tpm2_unseal_cmd(chip, payload, options, blob_handle);
312+
tpm2_flush_context(chip, blob_handle);
312313

313314
return rc;
314315
}

0 commit comments

Comments
 (0)