Skip to content

Commit a6d2786

Browse files
vsukhomlgregkh
authored andcommitted
tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations
commit db4d8cb upstream. TPM 2.0 Shutdown involve sending TPM2_Shutdown to TPM chip and disabling future TPM operations. TPM 1.2 behavior was different, future TPM operations weren't disabled, causing rare issues. This patch ensures that future TPM operations are disabled. Fixes: d1bd4a7 ("tpm: Issue a TPM2_Shutdown for TPM2 devices.") Cc: stable@vger.kernel.org Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> [dianders: resolved merge conflicts with mainline] Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4cce48a commit a6d2786

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/char/tpm/tpm-chip.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ static int tpm_class_shutdown(struct device *dev)
289289
{
290290
struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev);
291291

292+
down_write(&chip->ops_sem);
292293
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
293-
down_write(&chip->ops_sem);
294294
if (!tpm_chip_start(chip)) {
295295
tpm2_shutdown(chip, TPM2_SU_CLEAR);
296296
tpm_chip_stop(chip);
297297
}
298-
chip->ops = NULL;
299-
up_write(&chip->ops_sem);
300298
}
299+
chip->ops = NULL;
300+
up_write(&chip->ops_sem);
301301

302302
return 0;
303303
}

0 commit comments

Comments
 (0)