Skip to contentSkip to conversation

Patch "tpm: fix a race condition in tpm2_unseal_trusted()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Oct 14, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tpm: fix a race condition in tpm2_unseal_trusted()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tpm-fix-a-race-condition-in-tpm2_unseal_trusted.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From d4816edfe706497a8525480c1685ceb9871bc118 Mon Sep 17 00:00:00 2001

From: Jarkko Sakkinen <[email protected]>
Date: Tue, 16 Aug 2016 22:00:38 +0300
Subject: tpm: fix a race condition in tpm2_unseal_trusted()

From: Jarkko Sakkinen <[email protected]>

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")
---
 drivers/char/tpm/tpm-dev.c       |    2 
 drivers/char/tpm/tpm-interface.c |   51 ++++++++++---------
 drivers/char/tpm/tpm-sysfs.c     |    2 
 drivers/char/tpm/tpm.h           |   12 +++-
 drivers/char/tpm/tpm2-cmd.c      |  101 +++++++++++++++++++++++++--------------
 5 files changed, 103 insertions(+), 65 deletions(-)
drivers/char/tpm/tpm-dev.c +1 -1
@@ -139,7 +139,7 @@ static ssize_t tpm_write(struct file *fi
 
 	/* atomic tpm command send and result receive */
 	out_size = tpm_transmit(priv->chip, priv->data_buffer,
-				sizeof(priv->data_buffer));
+				sizeof(priv->data_buffer), 0);
 	if (out_size < 0) {
 		mutex_unlock(&priv->buffer_mutex);
 		return out_size;
drivers/char/tpm/tpm-interface.c +28 -23

162 lines not on this page · raw message

drivers/char/tpm/tpm-sysfs.c +1 -1
@@ -39,7 +39,7 @@ static ssize_t pubek_show(struct device
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 
 	tpm_cmd.header.in = tpm_readpubek_header;
-	err = tpm_transmit_cmd(chip, &tpm_cmd, READ_PUBEK_RESULT_SIZE,
+	err = tpm_transmit_cmd(chip, &tpm_cmd, READ_PUBEK_RESULT_SIZE, 0,
 			       "attempting to read the PUBEK");
 	if (err)
 		goto out;
drivers/char/tpm/tpm.h +8 -4
@@ -498,11 +498,15 @@ extern struct class *tpm_class;
 extern dev_t tpm_devt;
 extern const struct file_operations tpm_fops;
 
+enum tpm_transmit_flags {
+	TPM_TRANSMIT_UNLOCKED	= BIT(0),
+};
+
+ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,
+		     unsigned int flags);
+ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd, int len,
+			 unsigned int flags, const char *desc);
 ssize_t	tpm_getcap(struct device *, __be32, cap_t *, const char *);
-ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
-		     size_t bufsiz);
-ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, int len,
-			 const char *desc);
 extern int tpm_get_timeouts(struct tpm_chip *);
 extern void tpm_gen_interrupt(struct tpm_chip *);
 extern int tpm_do_selftest(struct tpm_chip *);
drivers/char/tpm/tpm2-cmd.c +65 -36

221 lines not on this page · raw message

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/tpm_crb-fix-crb_req_canceled-behavior.patch queue-4.4/tpm-fix-a-race-condition-in-tpm2_unseal_trusted.patch