lkml.org 
[lkml]   [2016]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()
On Sun, Aug 28, 2016 at 08:36:52AM +0200, Jarkko Sakkinen wrote:
>
> @@ -576,7 +576,8 @@ static int tpm2_load(struct tpm_chip *chip,
> goto out;
> }
>
> - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "loading blob");
> + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, TPM_TRANSMIT_UNLOCKED,
> + "loading blob");

I still don't like this, required mutex's should not be split outside the
function that needs them without more a more obvious indication:

> + mutex_lock(&chip->tpm_mutex);
> rc = tpm2_load(chip, payload, options, &blob_handle);
> if (rc)
> - return rc;

I recommend you stick with the idiom and do this:

mutex_lock(&chip->tpm_mutex);
rc = tpm2_load(chip, payload, options, &blob_handle, TPM_TRANSMIT_UNLOCKED);

Which makes it easy to see we are doing it right everywhere.

Jason

\
 
 \ /
  Last update: 2016-09-17 09:58    [W:0.039 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site